Expertsystemen

 

How to use regression tests

When testing it is often desired to test a certain situation after changing the model. By using a regression test, variables defined earlier will remain the same and can be used again, without having to fill in the same data repeatedly. Let’s have a look.

Before you are able to start testing, you will need a (simple) model. In this tutorial, a model will be used that exists of three nodes.

The node introduction contains a text reading ‘Welcome to this tutorial on regression testing’. The node data asks the user to fill in a number between 0 and 100 and the node called result shows the chosen number.

Adding a test

To start testing your model, or a specific part of the model, save your model and run it. In the Runner, select File > Start making test or press [F8].

creating a test
creating a test

In the screen that pops up, you are able to give your test a name. For this example, just name it ‘test_one’. When you press [OK], a recording will start tracking everything in the current case.

naming the test
naming the test

Now, run through the model until you have reached the final node. Then, select File > Stop making test or press [F8] again to stop the recording.

Running the test

After creating a test you can select it with File > Test suite or [Ctrl+F8].

In case you have recorded multiple tests, you will see them in the window below. You can run a single test, run all tests or delete tests you made.

regression test overview
regression test overview

When the first checkbox, ‘Compare with current model’, is checked, the test will check whether there are changes in the current model compared to the model as it was when creating the test. Since nothing has changed, running the test should return ‘OK’.

Changing the model

Now we will make a few changes to the model. Let’s change the text in the node introduction to ‘Welcome to this advanced tutorial on regression testing’, and add a question that asks the user’s age to the node data.

If you now run the test again, you will see the results of the test in the window on the right (see picture below).

test results after changing the model
test results after changing the model

This way, you are able to spot differences in your models easily without the need to fill in all inputs over and over again.