Support methods for scripted unit tests. Provides several assertion methods and utility functions to manipulate the current test instances and states.
Method | Description |
---|---|
addMetaData() | Append generic data to the current test, testfile or test suite. |
assertEquals() | Expect two objects to be equal. |
assertFalse() | Asserts when provided value is true . |
assertMatch() | Asserts when provided value does not match to a given regular expression pattern. |
assertNotEquals() | Expect two objects not to be equal. |
assertNotNull() | Asserts when provided value is null . |
assertNull() | Asserts when provided value is not null . |
assertTrue() | Asserts when provided value is false . |
assertion() | Create a new assertion for the current test. |
createReport() | Create a test report file. |
endTest() | End the current test. |
error() | Force an error for the current test entity (test/testclass/testfile/testsuite). |
executeUserCode() | Execute code registered in the testsuite. |
failure() | Force a failure (=assertion) for the current test entity (test/testclass/testfile/testsuite). |
getReportTypes() | Get a list of available test report types. |
getTest() | Get the current unit test. |
getTestFile() | Get the currently executed test file instance. |
getTestSuite() | Get the current test suite. |
ignoreTest() | Ignore the current test. |
loadTestSuiteDefinition() | Load a test suite definition from a given resource. |
saveTestSuiteDefinition() | Save a test suite definition to a file. |
setTestTimeout() | Set the timeout for the current test. |
startTest() | Start a specific unit test. |
void addMetaData(String name, Object value)
Append generic data to the current test, testfile or test suite.
IAssertion assertEquals(Object expected, Object actual, [Object errorDescription])
Expect two objects to be equal.
assertion containing comparison result
IAssertion assertFalse(Boolean actual, [Object errorDescription])
Asserts when provided value is true
.
assertion depending on actual
value
IAssertion assertMatch(String pattern, String candidate, [String errorMessage])
Asserts when provided value does not match to a given regular expression pattern.
assertion depending on actual
value
IAssertion assertNotEquals(Object expected, Object actual, [Object errorDescription])
Expect two objects not to be equal.
assertion containing comparison result
IAssertion assertNotNull(Object actual, [Object errorDescription])
Asserts when provided value is null
.
assertion depending on actual
value
IAssertion assertNull(Object actual, [Object errorDescription])
Asserts when provided value is not null
.
assertion depending on actual
value
IAssertion assertTrue(Boolean actual, [Object errorDescription])
Asserts when provided value is false
.
assertion depending on actual
value
void assertion(IAssertion reason)
Create a new assertion for the current test. According to the assertion status an error might be added to the current testcase.
void createReport(String reportType, ITestEntity suite, Object fileLocation, String title, String description)
Create a test report file.
void error(String message)
Force an error for the current test entity (test/testclass/testfile/testsuite).
Object executeUserCode(String location)
Execute code registered in the testsuite.
execution result
void failure(String message)
Force a failure (=assertion) for the current test entity (test/testclass/testfile/testsuite).
String getReportTypes()
Get a list of available test report types.
String array containing available report types
ITest getTest()
Get the current unit test.
the current test or a generic global test scope if called outside of a valid testcase
ITestFile getTestFile()
Get the currently executed test file instance. The test file is not a file instance but the runtime representation of a testsuite test file.
test file instance
void ignoreTest([String reason])
Ignore the current test.
ITestSuiteDefinition loadTestSuiteDefinition(Object location)
Load a test suite definition from a given resource.
test suite definition
void saveTestSuiteDefinition(ITestSuiteDefinition testsuite, Object fileLocation)
Save a test suite definition to a file.
void setTestTimeout(long timeout)
Set the timeout for the current test. If test execution takes longer than the timeout, the test is marked as failed.