Assertions

An introduction to assertions in mabl

Assertions are a fundamental component of testing; they help answer the question, "Is my application behaving as expected?"

At a high level, a browser test consists of the following:

  1. An action in the application under test, such as clicks, entering text, and visiting a URL.
  2. Assertion(s) to verify that the previous actions yielded the expected result.

For example, after taking the actions to log into an application, a good assertion would validate that these actions yielded the expected results. In this instance, after logging in, the assertion validates that the username appears on the page.

600

Recording assertions

When you create an assertion, you define the logic mabl should use to confirm that your application is in the correct state at a specific step in a test run. In a mabl browser test, you can make assertions against the following:

Detailed information and steps for each type of assertion can be found in the links listed above.

586

Example of an element assertion

📘

Assertion character limit

Assertions have a character limit of 300. If you are trying to assert on an element that has more than 300 characters, mabl will capture only up to 300 characters.

Configuring assertions

The following settings can be configured for element, variable, URL, and cookie assertions:

Disable case sensitivity

If you check "disable case sensitivity", mabl checks that the value matches what you expect without regard to what letters are in uppercase or lowercase.

For example, if your application displays names in all capital letters in some parts ("SMITH") and only partially capitalized in other parts ("Smith"), then case insensitive assertions could be used to validate the the same name is being displayed in both areas.

📘

Note

The "disable case sensitivity" option may behave unexpectedly for certain characters and languages where casing exists and the rules differ significantly from standard English.

For example, some languages use the dotted uppercase I character "İ", which will not necessarily be considered equivalent to the dotted lowercase "i" with case sensitivity disabled.

Continue on failure

If you check "Continue on failure", the assertion will pass regardless of whether the element meets the assertion criteria. If the step does not pass in a cloud run, it will show a warning instead of a failed step.

1114

Example of an assertion that continued on failure.

🚧

Continue on failure does not fail tests

Continue on failure is mabl's current implementation of a "soft assertion." If the assertion fails, it will still mark the test as passed. The only way to know what happened in a "continue on failure" assertion is by reviewing the individual cloud run.

Lexicographic comparisons

If an assertion type involves a comparison - greater than, less than, greater than or equals, and less than or equals - and the assertion values cannot be interpreted as numbers, mabl orders the values according to their characters' Unicode code points. In this standard, the order of values from lowest to highest is as follows:

  • Numbers (123...)
  • Capital letters (ABC...)
  • Lowercase letters (abc...)