TestCaseTable#

Alternatively to sequential test cases (Doc TestCase) there is another way to define a test case using the TestCaseTable markup.

%%TestCaseTable 
|| Time	|| Engine noises|| "Check: Ignition timing."||"Average mileage /100km"|| Checks	
|  0s	|  ringing	|   	                     |                         | Bad ignition timing = Suggested
|  1s	|  ringing	|              ok            |              10.0       | Bad ignition timing = Excluded
@name: TableTestCase
%

Renders as:

Screenshot of a TestCaseTable markup

It is possible to specify a name and a time for each row of the line in the first two columns (name must occur before time). If a column header is named "Checks" this column specifies checks being executed in that line. All conditions from the rule markup can be used as checks. On all other columns a question must be referenced in the header cell and a compatible value in the table cells.

The annotation name optionally specifies a name of the table, if no name is specified, the tables gets numbered.

Defining a Test Case with a another Test Case as its Prefix#

The TestCaseTable markup allows to define any other named TestCaseTable as its prefix. When viewed in the TestCasePlayer, both cases are stitched together and are viewed and run as one. This is useful, if you have many test cases for the same knowledge base, that for example share a common initialization or start sequence. This common initialization can then be defined as a prefix test case to be prepended to all the actual test cases.

The last row of the prefix test case and the first row of actual test case are merged into one, so it is advisable to define the last row in the prefix test case (or the first of the actual test case) empty with just a time stamp. This way, it is possible to define the time gap between the prefix and the actual test case. All time stamps in the actual test case are shifted to the future by the time it takes to run the prefix test case (defined by the timestamps of the prefix).

The prefix mechanism works recursively, so it is possible to set a test case that has a prefix as the prefix of yet another test case (and so forth).

Cxample for usage of prefixes:#

First, we define our prefix test case where we initialize some variables like weight height and age. They will not change during the test case, so they can easily be extracted. We add a second line, where we set the time stamp to 5 min. In the screenshot below, you will see, that all the time stamps will be shifted by 5 minutes (since this is a simple example, the 5 minutes are not really necessary for the test and are for demonstration purposes only).

%%TestCaseTable
|| Name			|| Time	|| Checks || Weight || Height	|| Age	
|  Normal adult values	|  0s	|   	  |  75	    |  1.8	|  21	
|   			|  5min	|   	  |   	    |   	|   	
@name: Initial Questions
%

TestCaseTable
Prefix testcase 'Initial Questions' does not exist or has errors
Name: At RestPrefix: Initial Questions
TestCaseTable
Prefix testcase 'Initial Questions' does not exist or has errors
Name: Hard physical activityPrefix: Initial Questions
Together with a TestCasePlayer it renders like this:

Screenshot of test cases using prefixes

Related Doc Pages#