How to use regression test
This feature is only available from version 4.1 onwards.
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: ‘introduction’ – ‘data’ – ‘result’.
The ‘introduction’ node contains a text stating ‘Welcome to this tutorial on regression testing.’ The ‘data’ node ask the user to fill in a number between 0 and 100 and the ‘result’ node states 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, go to ‘File’ and select ‘Start making test’ or simply press ‘F8’.
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’, the Runner will start recording.
Now, run through the model until you have reached the final node. Then, go to ‘File’ and select ‘Stop making test’ or press ‘F8’ to stop the recording.
Running the test
Now that you have created a test, you can also run it. To do so, go to ‘File’ in the Runner and click on ‘Test suite’ or press ‘Ctrl + F8’. Here, you should see your test. At the bottom, you will find several buttons and checkboxes. The buttons are self-explanatory.
In case you would have recorded multiple tests, you will them in the window below. You can run a single test, run all tests or delete tests you made.
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 been changed, running the test should return ‘OK’.
Changing the model
To show the strength of regression testing, a few changes will be made to the model. The text in the node ‘introduction’ will be changed to ‘Welcome to this advanced tutorial on regression testing.’ Besides, a question that asks the user’s age will be added 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).
This way, you are able to spot differences in your models easily without the need to fill in all variables over and over again.