Geek Culture

A new tech publication by Start it up (https://medium.com/swlh).

Follow publication

Member-only story

Optimize Selenium WebDriver Automated Test Scripts: Maintainability

Zhimin Zhan
Geek Culture
Published in
6 min readJun 21, 2021

--

Working automated test scripts is only the first test step to successful test automation. As automated tests are executed often and the application changes frequently, it is important that test scripts need to be:

Fast
Easy to maintain
Easy to read

The №1 technical reason that most test automation attempts failed is that the team fail to maintain the automated test scripts. That’s why most software companies have tried test automation but failed to keep 20 automated tests ( Level 1 of AgileWay Continuous Testing Grading) running reliably and regularly.

In the article, I will show you some simple and practical tips, at the test step level, to enhance the maintainability of automated functional tests.

At a higher level, automated test scripts must be designed with maintenance in mind, such as Maintainable Test Design.

These techniques/tips are:

  • One Test Script Line for One User Operation
  • Default Parameter Value
  • Extend function behaviour with optional Hashmap

The test script examples are in Ruby syntax. But most techniques are applicable to other languages as well.

1. One test script line for one user operation

Programmers who are new to test automation, like me 15 years ago, usually write poor automated tests. I have figured out one rule by working with many manual testers for years: functional tests scripts shall match user operations as close as possible.

The rule reflected on the test step is one test script line for one user operation. A user operation can be

  • driving the application, e.g. clicking a link, or
  • assertion, e.g., assert the value of a text box

Benefits of One Test Script Line for One User Operation

  • Simple and Intuitive
    Remember, the audience of functional tests are the whole team. The simpler, the…

--

--

Zhimin Zhan
Zhimin Zhan

Written by Zhimin Zhan

Test automation & CT coach, author, speaker and award-winning software developer. Help teams succeed with Agile/DevOps by implementing real Continuous Testing.

Responses (1)

Write a response