Skip to main content
Test scenarios

Learn how to use test scenarios in an exercise

Updated over 7 months ago

Within the open exercise type, you can use Test Scenarios. A test scenario is a list of dummy student answers. It is meant for authors to test their (positive and negative) feedback and the solution of an exercise, without having to type and check all dummy student answers one by one.

From the “Edit exercise” perspective, test scenarios can look like this:

Test cases should be written in Math presentation format (tex or asciimathml). When no delimiters are used (as in the picture), hashtags are used by default. It is also possible to use variables in the test cases, as long as the variable is in tex or asciimathml.

Example: if $solution_tex -> 1/a then it won’t work, since “/” is not a valid operator in tex or asciimathml. Instead, one should have $solution_tex -> \frac{1}{a} for it to work as a test case, since \frac is a tex operator for division.

You can add as many test scenarios as you like and every scenario can have as many answer fields as you like. You can rename the test scenarios by clicking on “Test scenario i” and then changing the name. Don’t forget to click “Save” after making any changes.

Important note: the test scenario feature only works if the open type exercise has only one answer field. Exercises have only one answer field by default. The number of answer fields can be found and changed in the “General” tab.

From the ‘preview exercise’ perspective, the test scenarios look as follows:

Hover over the red button to see the name of the test scenario.

If we click on the red button with “1”, the first test scenario is loaded. This looks as follows:

It may take a while before all test cases are loaded. If we click on the red button with “2”, the second test scenario is loaded. This test scenario contains only one test case and this should be the correct answer:

Note that test scenarios can be loaded in any order you want. However, if you load a test case that has the correct answer (and thus results in a green checkmark), the exercise stops and no other test cases can be loaded. When refreshing the exercise, all test scenarios will be visible again. For this reason, we recommend writing a separate test case with just the correct answer and writing one or more extra test cases for wrong or partially correct answers.

Did this answer your question?