test.case - Palamecia/mint GitHub Wiki
Module
load test.case
This module provides the Test.Case class which is a base class to implement test cases.
Packages
Classes
Test.Case
Test.Case provide a base class to implement test cases. Any member of a class
derived from Test.Case that starts with 'test'
is automatically added to the
test case. This class also provide methods to test values such as expectEqual.
Example:
load test.case
class MyTestCase : Test.Case {
def testAddOneAndOne(self) {
self.expectEqual(2, 1 + 1, '1 + 1 is not 2')
}
}
Members
Modifiers | Member | Description |
---|---|---|
~ const |
discover | Initialize the set of test members to call and return the amount of tests fou... |
+ const |
expectDefined | Test for defined value . If given value is not defined, the test fail. If ``... |
+ const |
expectEqual | Test for equality between expected and result . If given values are not eq... |
+ const |
expectIsNotSame | Test for address inequality between expected and result . If given address... |
+ const |
expectIsSame | Test for address equality between expected and result . If given address a... |
+ const |
expectNotDefined | Test for undefined value . If given value is defined, the test fail. If me ... |
+ const |
expectNotEqual | Test for inequality between expected and result . If given values are equa... |
- final |
failed | Internal list of failed test methods. |
- final |
failuresCount | Internal counter of test failures. |
- final |
found | Internal list of found test methods. |
- @ |
g_lib | Global library handle. |
- final const |
getTestName | Extracts the name of the given test method. |
~ const |
isFailing | Returns true if at least one test has failed; otherwise returns false . |
~ const |
list | Returns the list of test names found in this test case. |
- @ const |
printValue | Returns a printable string representation of value based on its type. |
~ const |
run | Run test members. To initialize the set of test members to run, discover must... |
~ const |
showSummary | Print the summary of failed tests on standard output. |
Descriptions
Test.Case.discover
def (self, filter = /.*/)
Initialize the set of test members to call and return the amount of tests found.
Test.Case.expectDefined
def (self, % value, message = none)
Test for defined value
. If given value is not defined, the test fail.
If message
is given, the message is printed on the standard output.
Test.Case.expectEqual
def (self, % expected, % result, message = none)
Test for equality between expected
and result
. If given values are not equal,
the test fail. If message
is given, the message is printed on the standard output.
Test.Case.expectIsNotSame
def (self, % expected, % result, message = none)
Test for address inequality between expected
and result
. If given address are
equal, the test fail. If message
is given, the message is printed on the standard
output.
Test.Case.expectIsSame
def (self, % expected, % result, message = none)
Test for address equality between expected
and result
. If given address are not
equal, the test fail. If message
is given, the message is printed on the standard
output.
Test.Case.expectNotDefined
def (self, % value, message = none)
Test for undefined value
. If given value is defined, the test fail.
If message
is given, the message is printed on the standard output.
Test.Case.expectNotEqual
def (self, % expected, % result, message = none)
Test for inequality between expected
and result
. If given values are equal,
the test fail. If message
is given, the message is printed on the standard output.
Test.Case.failed
[]
Internal list of failed test methods.
Test.Case.failuresCount
0
Internal counter of test failures.
Test.Case.found
[]
Internal list of found test methods.
Test.Case.g_lib
lib ('libmint-test')
Global library handle.
Test.Case.getTestName
def (const self, test)
Extracts the name of the given test
method.
Test.Case.isFailing
def (const self)
Returns true
if at least one test has failed; otherwise returns
false
.
Test.Case.list
def (self, filter = /.*/)
Returns the list of test names found in this test case.
Test.Case.printValue
def (value)
Returns a printable string representation of value
based on its type.
Test.Case.run
def (self)
Run test members. To initialize the set of test members to run, discover must be called first. This member should be called using Test.Suite.run.
Test.Case.showSummary
def (self)
Print the summary of failed tests on standard output.