Skip to content

Testing

The COOM language allows for the definition of test cases, simulating configuration sessions for regression testing.

A test case is a sequence of lines posing instructions to a simulated configuration session. The block test defines a test case, allowing for the instructions set, is, shows, and can.

test {
    // Set the front wheel to value W14
    set frontWheel = W14

    // Checks whether the rearWheel is set to value W14 
    //   consistently (thus derived in all remaining valid solutions)
    is rearWheel = W14

    // Set the front wheel to choice W16
    set frontWheel = W16
    is rearWheel.size = 16

    // Checks whether the color yellow is still a valid choice
    //   for at least for one remaining valid solutions
    can color = Yellow

    // Checks whether the value W16 is shown for frontWheel
    //   in the current situation (?)
    shows frontWheel = W16
}

The shown example sets the value W14 to the element frontWheel and subsequently checks if the value of rearWheel is also set to the choice W14.

Afterwards, the value W16 is assigned to the element frontWheel and we then check if the attribute rearWheel.size is set to the integer value 16.

The last line checks whether the choice Yellow of the color can in principle still be selected by the user in this configuration session.

For the statements can and is you can use equal (=), not-equal (!=), and the numerical comparators <, <=, >, and >=. Further complex logical expressions can be composed using the boolean operators AND (&&), OR (||), and NOT (!).

Extension: The keyword add can be used to add new instances of a element with user-defined cardinalities.