Best Practices

mabl uses machine learning to create robust automated tests 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 a short doc to explain how to get the most out of mabl:

1. Make use of mabl’s auto-login feature.

  • 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 journeys.
  • If you use auto-login, take care to avoid logging in during your training session; this will result 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.
  • It may also be helpful to add a short wait step directly after you login, to make sure the webpage has time to load before executing. Please see the "Adding wait steps with the mabl trainer" document for more information.

2. Clear your local browser storage.

  • Your local storage may contain settings that affect the application state. mabl’s test machines will not have that state. Navigate to the “Application” tab in Chrome developer tools and clear application storage before you start training.

3. Test the same journeys across multiple environments.

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

4. Consider using “Find Element” if your test environment has dynamic data.

  • You can access this feature via the toolbar within the trainer.
  • This makes it easy to create a test that looks for elements by xpath or CSS selector.
  • During training, the trainer will automatically highlight any elements that match your query.

5. Capture hovers when they are part of your journey, 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.

6. Use variables to generate unique data for each run.

  • You can define and use variables via the toolbar within the 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.

7. Use a 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” journey.

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 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.

  • mabl supports basic auth.
  • You can use custom http headers and/or static IP addresses to whitelist mabl traffic in firewall rules
  • A custom user agent header (x-mabl-agent) is included in all mabl http requests by default.

All set?

Click here to jump back into mabl to start testing!