Your Best Practice Tips for building reliable scripts.

Over the years I’ve fallen into some pretty bad habits that I would love to break. One of the things that I always strive for is creating scripts that only fail when there is a problem and never because of some slight change to the SUT or slowness in the SUT. I realize this is an ongoing process as much as it is a goal. I’d like to ping the community to get your best tips in creating bullet proof scripts.

Some ongoing thoughts:

  1. Your testing a browser and a page that took 5 seconds to load now takes a minute. Your script fails but there is no bug just because of slow load time. What is the best code for avoiding this?

  2. You capture an image to CLICK and a few runs later or a month later the same image which looks perfectly fine is no longer found. How do you avoid this?

I know there are areas of the Manual that cover these things. But I’m curious to see if any of you out there have found other solutions.


Best practices for building reliable scripts:

  1. Do not rely only on UI test automation
  2. Consider using a BDD framework
  3. Always always always use test design patterns and principles
  4. Never use Thread.sleep() unless there are specific test requirements
  5. Do not run ALL tests across ALL target browsers
  6. Separate your tests from your test automation framework
  7. Make your test automation framework portable
  8. Name your tests wisely
  9. Use soft assertions if you need to make a list of related checks on the same web page
  10. Take screenshots for failure investigation
  11. Make tests simpler instead of adding comments

You can use a platform like QAppAssure which allows you to test on-cloud and on-field devices, across 100+ device, make and models, Integrate with Jira, CI/CD tools, and also use Appium, Calabash, Espresso, UIAutomator, XCUITest.