Specifying Test Code

Traces are translated into executable test cases based on test code entered into the model. The test code is entered as verbatim text, so any language or execution back-end can be used. Test code can be entered in five areas: Prefix code, state enter code, state exit code, edge code, and postfix code.

Prefix (and postfix) code is entered in a comment in the System declarations window. A multi-line comment starting with the word PREFIX (or POSTFIX) is considered as prefix (or postfix) code. Each test case starts with the prefix code and ends with the postfix code.

Each state in the transition system has two areas for test code. Double clicking a state in the editor will bring up a window with a test code tab. The state enter code is added to the test case when this state is reached, and the state exit code is added when the state is left.

Similarly double clicking an edge will bring up a window with a single test code field. This code is added to the test case when the edge is taken.

For state and edge test code the value of variables can be entered into the test case. This is done using $(var) for global variables or $(Process.var) for local variables. Dollar signs can be escaped with \$ and backslash can be escaped with \\. For state enter code the value is read after the transition into the state has been taken. For state exit code the value is read before the transition out of the state is taken. For edge code the value is read before taking the transition.