Assertions for Mobile Tests
Add assertions to Endtest Mobile Tests for iOS and Android: assert on element presence, text, attributes, screen state, and natural-language conditions.
Introduction
We need assertions to know if our test execution was successful or not. If we do not add assertions in our test cases, the values for Passed and Failed will be zero. A test case can have more than one assertion.
Solution
Assertions can be added by using the Add Assertion action. You can choose from the following types of assertions:
| Assertion Type | Description |
|---|---|
| Element Is Present | Checks if an element is present |
| Element Is Not Present | Checks if an element is not present |
| Element Matches Value | Checks if the text from an element matches a certain value |
| Element Does Not Match Value | Checks if the text from an element does not match a certain value |
| Element Contains Value | Checks if the text from an element contains a certain value |
| Element Does Not Contain Value | Checks if the text from an element does not contain a certain value |
| Element Contains Attribute | Checks if an element contains a certain attribute |
| Element Does Not Contain Attribute | Checks if an element does not contain a certain attribute |
| Variable Assertion | Provides multiple ways to check a variable |
| Page Source Contains Value | Checks if the Page Source contains a certain value |
| Page Source Does Not Contain Value | Checks if the Page Source does not contain a certain value |
| Visual Assertion | Performs a visual comparison between the screen or an element and a baseline screenshot. Details in the Visual AI chapter. |