AMA: What should be the ideal length of an automated test script?

Sajitha Pathirana
3 min readAug 10, 2022

That’s a tricky question to answer!

Keeping the test short or long depends on many factors like the expectations of the testing, the scope of the automation, the complexity of the application and the domain, your experience, and so on.

Photo by patricia serna on Unsplash

Keeping a test short vs long has its own pros and cons.

To keep this answer short I will highlight major points.

  • If a test is left short, which means validating one point, the single test will be fast, stable, and easy to narrow down any issues. However, on the other hand, we will have to maintain a large number of tests to increase the coverage, and could be challenging to maintain the test bed.
  • If a test is long, covering many scenarios, the number of tests we may need to increase the coverage would be less, easy to maintain the test bed. The disadvantage would be if an issue occurred in the middle of the script, the rest of the script will fail. Due to this, a minor failure can stop more important parts of the test from executing.

As automation engineers, we need to focus on time, ROI, and maintainability.

My suggestion is a mix of both long and short tests should be occupied to retain the balance of time and ROI.

--

--

Sajitha Pathirana

A Test automation enthusiast, passionate to help the teams to enhance their testing journey with his decade of experience in the field.