Base agent for developing functional tests.
Tests are defined in the tests() method that subclasses should implement. Individual tests are defined using the test() method, and test groups are defined using the group() method.
Tests that return null or true are displayed as PASS. Tests that return false are considered as FAIL. Tests that return other values are considered to have passed, and the string value is included in the report. If a test has assertions that fail or exceptions that are thrown, the test is considered to have failed and details are logged in the log file. All test report entries in the log file are marked as [TEST] for ease of search.
Type Params | Return Type | Name and description |
---|---|---|
|
String |
getDescription() Gets help information on using the test. |
|
int |
getIterations() Stops periodic tests. |
|
String |
getReport() Gets the last test report. |
|
String |
getRun() Runs the test once. |
|
String |
getStart() Starts the test periodically. |
|
String |
getStop() Stops periodic tests. |
|
protected void |
group(String name, Closure cl) Define a group of tests. |
|
void |
setup() |
|
void |
startup() |
|
protected void |
test(String name, String value) Define a test. |
|
protected void |
test(String name, Closure cl, int mustPass = 1, int outOf = 1) Define a test. |
|
protected void |
tests() Defines the tests to run. |
Run test automatically on startup, and kill agent on completion. A test agent that is designed to run a test once and quit may set this to true during startup().
Total duration (in seconds) for periodic tests (0 = run for ever).
Period (in seconds) for periodic tests (0 = aperiodic).
Gets help information on using the test.
Stops periodic tests.
Gets the last test report.
Runs the test once.
Starts the test periodically.
Stops periodic tests.
Define a group of tests.
name
- name of the test groupcl
- closure that will run all the tests in the groupDefine a test.
name
- name of the testvalue
- value to displayDefine a test.
name
- name of the testcl
- closure that runs the testmustPass
- minimum number of times the test should passoutOf
- maxmimum number of times the test should be runDefines the tests to run. This method should be overridden by subclasses to provide the body of the test.