The purpose of the software tests, besides compliance with the execution procedures, is to be able to control that the software complies with the expected behavior.
We will see what are the functions of Agilitest that allow to perform controls or assertions in your software tests.
The check function
Everything goes through the function "Check", which comes in three sub-functions:
- Check Properties
- Check occurrences
- Check values
"Check properties" and "Check values" will work the same way. The only difference is that in one case we will check the properties of one UI element and in the other the values of a variable.
Check occurrence will control the number of items counted in the displayed page of the tested software.
This function takes as input an interface element that will have to be captured.
In the example above, we select a SPAN with an "id" equal to "cwos".
We then check its "text" property which must be equal to 4.
The verification function will perform the comparison considering both parameters as strings; and accepts regular expressions.
This function takes as input a variable that can be modifiable or not.
The operation is then identical to the "Check properties" action.
The occurrence check controls the number of items found on the current page using an Agilitest locator.
Indeed, in some cases, it may be useful to define locators which can match multiple elements. This allows for example to control the number of rows or columns of a table.
The "Check occurrence" action is also very useful for adding more robustness to your tests.
Check occurrence and graphic recognition
Occurrence checking also works with graphical elements.
You will be able to check that an image is present a number of times in the displayed page.
This differs from a check based on the software structure, for example the DOM, for which even non-displayed items will be counted.
You can also combine occurences checking and graphical recognition to determine when you will be able to continue your test. In the example below, we are waiting for a processing to be done by checking its "progress bar", and comparing it by the one to be displayed at the end of the processing.