A suite of test cases consists of several (but at least one) sequential test cases. Within a sequential test case several (but again at least one) rated test cases are defined. A rated test case specifies the expected solution state if certain answers are provided for certain questions. Extending a sequential test case iteratively through additional rated test cases permits to observe how the solutions' states change if further questions are answered or if previous answers are modified.

Test suites mainly aim at verifying that derived solution states match the expected solutions' states defined in the rated test cases. Solutions are automatically derived when a test suite is run (see below).

Syntax #

A wiki article in KnowWE can only contain multiple blocks of test cases. Inside these TestCase blocks any number of sequential test cases can be defined, and within those in turn the rated test cases.

A sequential test case is first given a user-defined name. This name is followed by opening and closing curly braces, containing the rated test cases.

In a rated test case first all the findings (in the form question = answer) are listed, separated by commas; the last finding, however, is followed by a colon. After that colon all expected solutions (followed by their expected state in braces) are listed, separated by commas. Following the last solution is a semicolon.

"Leaking air intake system (Demo)" {
    Driving = insufficient power on partial load :
    Leaking air intake system (suggested);
    Driving = unsteady idle speed :
    Clogged air filter (suggested);
    "Check: Air filter." = ok,
    "Average mileage /100km" = 10,
    "Real mileage  /100km" = 12,
    Driving = insufficient power on full load :
    Leaking air intake system (established);

"Clogged air filter (Demo)" {  
    Exhaust pipe color = sooty black,
    Fuel = unleaded gasoline :
    Clogged air filter (suggested);

    Driving = unsteady idle speed,
    Driving = weak acceleration,       
    "Check: Ignition timing." = ok :
    Clogged air filter (established);
@package: demo

The presented example contains two sequential test cases. The first one defines that the solution leaking air intake system should receive the state established if Air filter o.k.? is answered with yes and Driving with insufficient power on full load. The second rated test case constitutes an example for the solution clogged air filter.

Additionally, it is necessary to specify against which knowledge base you want to test. Therefore, you need the @master annotation. The argument for this annotation is the name of a wiki article containing a compiled knowledge base.

Please note that these examples are kept rather small to demonstrate the main functionality and the syntax. Test cases that are actually applied can or should be much bigger.

Running a test case: Test cases can be executed by using the Test Case Player.

Related Doc Pages#