Making assertions

When you define a test using the mabl Trainer, you can include assertions that describe logic that mabl should use to confirm that your application is in a correct state at a specified step in a test run.

Currently, mabl supports the following assertion types:

  • Selected element is present
  • An element is not present
  • A specific attribute or property of the selected element (e.g. innerText) using one of the following assertion types:
    • 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
  • Page URL
  • Cookie
  • Variable
  • Email

Step-by-step instructions for adding an assertion

  1. In the mabl Trainer window, click "Add assertion" (represented by the check mark).

  2. Choose your assertion: either click on the element on the page or select from the options in the mabl Trainer window.

  1. Complete the additional assertion fields. These will depend on the type of assertion you are making.
  2. Click "OK"
  3. Continue with your training session, if applicable.
A sample of how to alter and apply an assertion.A sample of how to alter and apply an assertion.

A sample of how to alter and apply an assertion.


Important assertion information

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.

Assertions are case-sensitive.

Cropping assertion screenshots to individual elements

mabl supports cropping the captured screenshot to the element instead of full screen when creating an assertion in the Trainer. This is useful if you just want to make it easier to see which element mabl interacted asserted on in detail, or if you'd like to do visual comparisons on the asserted element, even if the element moves around the screen.

The option is available on any assertion when training a test. To take advantage of it just create a new assertion, or edit an existing one and check the box like below.


Running assertion steps

All find actions in mabl, including assertions, will automatically wait up to 30 seconds for the targeted element to appear. There is generally no need to add an additional wait step before an assertion, unless the element will take more than 30 seconds to appear in your app or if the element comes into existence without being fully realized. In the latter case, a wait step before the assertion may be necessary as mabl will evaluate as soon as it detects that the target element exists. Find more information about wait steps in mabl at our "Adding wait steps with the mabl trainer" doc.

Did this page help you?