The basic element of the unit test language is the unit test itself. Every unit test can have global variables, an optional setup expression, a test expression and an optional cleanup expression. Additionaly some test contents can be assigned to the unit test.
Syntax |
test reference { User theuser;
init = expression { // optional init expression theuser = #User.ObjectCreate(); } expression { // test expression } cleanup = expression { // optional cleanup expression } testdata<tdid, tdcontent> = { { "word", file("resources/testdata/word.docx") } } } |
All expressions share the same local scope and can see the global variables of the scenario (see below) and the global variables of the unit test.
When evaluating a unit test, first the scenario is initialized if provided, then the setup expression, the test expression and the cleanup expression are evaluated. The cleanup expression is evaluated regardless of the result of the test expression.