General best practices

Mabl allows you to create robust automated tests supported by machine learning, so you don't have to worry about your tests failing for the wrong reasons.

To help you use mabl to its fullest potential, we've compiled these common practices:

1. Add assertions when a page changes

  • After navigating to a new page, add an assertion that verifies that you have arrived at the expected page.

2. Run the same tests across multiple environments

  • Start by training your test against any application environment, just create a plan and type in a new URL to test.
  • You can include that test in separate plans for QA, staging, production, etc.

3. Provide more context when prompted

When recording a test, the mabl Trainer may prompt you to provide more context. This is necessary to get more accurate and consistent test runs. You will also have the option to opt-out from auto-healing to suit your particular use case.

4. Use variables to generate unique data for each run

  • You can define and use variables via the toolbar within the mabl Trainer.
  • You can, for example, use a variable that will always insert a random string into a field.
  • This can help you work around uniqueness requirements within your application if you’re not always setting your test environment back to a pristine state between runs.
  • Check out the Using Variables documentation for more information.

  • Credentials are a pain to secure and maintain. If you use mabl’s auto-login feature, you can take advantage of our enterprise-grade key management service, and you can easily update credentials across tests.
  • If you use auto-login, take care to avoid logging in during your training session; this will result in two attempts to log in, and the second one will result in a failed test.
  • When using the feature, it helps to set your Plan's URL to the login page. This will greatly speed up your initial test execution time, as mabl won't have to search for a login form.

6. Capture hovers when they are part of your test, but use them sparingly

  • You can enable “record hovers” in the mabl Trainer.
  • When enabled, this adds a hover step each time your mouse hovers over an element.
  • Given that this can add many steps (which, in turn, can add significant test execution time), you shouldn’t enable it unless you are explicitly attempting to capture a hover event.
  • Hovers will not be recorded when the mouse is over the Trainer. If you can move the Trainer partially over the element you want to hover over and then move your mouse off the Trainer, only the desired hover step will be recorded.
  • A CSS Selector or XPath can also be used to send a hover to a specific element.

7. Use the "Use strict URL prefix" parameter to restrict the link crawler if needed.

  • This is a way to avoid testing your marketing site, docs, et.
  • You can set the parameter for any plan that includes the “Visit all linked pages” test.

8. Integrate mabl with your delivery pipeline

  • It is easy to submit deployment events and retrieve plan results via mabl API
  • Information is available via Settings --> APIs.
  • This triggers any plans that are scheduled to run on deployment.
  • Mabl also maintains a native Jenkins plugin.

9. If testing production, exclude mabl UI tests from your site analytics using filters for the following:

  • All requests feature the X-Mabl-Agent header, e.g. X-Mabl-Agent: Mabl/0.1
  • All User agent strings have a custom operating system property (contains mabl), e.g. Mozilla/5.0 (X11; Linux mabl) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36
  • All traffic emerges from the mabl static IP address block, unless the plan environment uses mabl Link

10. Secure your test environments

Here are the ways you can limit access to the application under test.

  • You can login to your application using username and password (HTTP basic authentication)
  • You can use custom http headers and/or static IP addresses to identify traffic originating from mabl and update your firewall rules accordingly
  • A custom user agent header (x-mabl-agent) is included in all mabl HTTP requests by default. You can use this header to identify traffic originating from mabl
  • For applications deployed behind a firewall, you can use mabl Link to provide secure access to mabl

For more best practice tips, check out the webinar session below, featuring one of our Customer Success Managers, Preston Betro, that is based on feedback gathered from hundreds of mabl users and showcases the most effective ways to utilize mabl's essential functionality.


All set?

Click here to jump back into mabl to start testing!

Did this page help you?