This guide provides an overview of how to create a variable assertion. Some use cases for variable assertions include:
- Extracting an element property into a variable on one page, extracting another element property from another page, and asserting that the two variables equal each other
- Modifying a variable with math or JavaScript and asserting that it equals the expected value
- Asserting on the expected value coming from a DataTable
Using variables as expected values
If you are looking for information on how to assert element properties or attribute values against the values that can come from a variable, see the documentation on element assertions.
Creating a variable assertion
- In the mabl Trainer window, click on the check mark icon to add an assertion.
- Select Variable in the Trainer window.
- Configure the assertion in the variable assertion menu.
- Click OK.
Configuring a variable assertion
The variable assertion menu is where you define the criteria of your assertion. These are the settings:
- Variable: When you choose a variable from the dropdown, its expected value is displayed.
-
Assertion type: Choose an assertion type. Supported assertion types for variables include:
- Equals
- Does not equal
- Contains
- Does not contain
- Starts with
- Does not start with
- Ends with
- Does not end with
- Greater than
- Less than
- Greater than or equals
- Less than or equals