Properties of mode objects – optional properties should not be specified if not applicable.
Property
Type
Mandatory
Notes
name
String
The mode name, in uppercase.
Note: Internally there is also a special "TIMEOUT" mode.
after
String
Test end event to call at the end of a unit test.
Possible values:
"DONE" – for synchronous tests
"WAIT" – for asynchronous tests
"TIMEOUT" – when an asynchronous test times out
appendTo
String
If test appends an existing test, this is the name of the test that results will be appended to.
Default: Do not append results to another test.
expect
Number
Number of results that must be logged before test is allowed to pass
Default: Do not prevent test from passing due to number of results
Note: Ignored if appendTo property is defined
ttl
Number
If after == "WAIT" and the test has not passed or failed, this is the amount of of time (in game milliseconds) the test remains active for until timing out.
Default:
If after == "WAIT": 1000 (1 game second)
If after == "DONE": Force fail/success as soon as test finishes (ignore ttl)
Test States
Public constants but really aimed at internal use...
State
Value
Notes
Test.UNIT_PENDING
undefined
Indicates the test has not yet started
Test.UNIT_RUNNING
null
Indicates the test is running (or waiting for more results in case of asynch mode)
Test.UNIT_SUCCESS
true
Indicates test has completed successfully
Test.UNIT_FAILED
false
Indicates test has failed
Test.UNIT_TIMEOUT
0
Indicates test has timed-out
Test End Events
Each unit test ends with one of the following events (either implicitly or due to a signal, etc).
Event
Notes
Effect on test state
"ERROR"
An error was thrown while running the test
Test.UNIT_FAILED
"ABORT"
An ABORT( ) signal was sent while running the test
Test.UNIT_FAILED
"REQUIRE"
A REQUIRE( ) signal was sent while running the test
Test.UNIT_FAILED
"DONE"
A synchronous test has finished
Test.UNIT_SUCCESS / Test.UNIT_FAILED
"FINISH"
A FINISH( ) signal was sent while running the test
Test.UNIT_SUCCESS / Test.UNIT_FAILED
"TIMEOUT"
An asynchronous test has timed-out
Test.UNIT_TIMEOUT internally
After end event, will become either:
Test.UNIT_SUCCESS / Test.UNIT_FAILED
"WAIT"
An asynchronous test has finished – check if it's passed, failed or still running
If passed or failed, redirect to "DONE"
Otherwise: Test.UNIT_RUNNING
Everything on this page relates to the internal code of the API and is thus liable to change without warning.
Contents
Jump to:
Roadmap
Future plans:
Implement set-up and tear-down features for unit tests Unlicensed user