Clean test-automation framework

A clean test-automation framework is a challenging task. I want to share a few tips I have learned from my mistakes to build an effective framework.

Photo by Pedro Lastra on Unsplash

The test-automation framework projects can get really messy extremely fast especially when a big team working on it. I will try to give common mistakes and tips to build clean and effective framework.

We will focus on three main concepts:

  1. Simplicity

Examples based on below technologies:
Selenium WebDriver

Simplicity. The most important idea to keep the test-automation project effective is to design it as simple as possible. Any test automation engineer by looking into your project for 5 min should be able to figure out the main components and mechanisms of the framework.

It’s easy to say make it simple, but how to achieve it, this is the question. Let’s start with a few bullet points

  1. Do not wrap libraries and change their API names. Usually, it’s done by tech leads or the main framework maintainers. I have seen these kinds of frameworks a number of times. It creates a big mess. Especially if they will try to force you to use these wrapper classes. Usually, people wrap the Selenium WebDriver by trying to make it more generic and adding waiting time or handling things via JS executor. Everyone knows how does Selenium WebDeriver works, but none this wrapper class. You can find all possible information about Selenium on the web and for specific wrapper classes not. Usually, for this kind of wrapper class, there is no clear documentation and defects are present. I think libraries are already enough generic and do not need to wrap it and create confusion.

Team oriented. While adding a new tool or changing an existing one or designing some reusable component, always think about your team. The main question is can they adopt it? It does not matter how cool is a new tool(library) or how great is your reusable component if your team cannot adopt it then no point.

Documentation. Every mechanism of the framework should be well documented and your team should be aware of these documentations.

Another good point of an effective framework is the setup process. let’s say a new-hire joined your team. Assuming he has all the required software and access, now it’s time to set up the project locally. How long it will take him? Can he do it by himself? Ideally, it should be cloning the repository and the project should be ready to go. All credentials, browser drivers, and all other stuff should be already handled. If we cannot avoid some setup process, the step by step setup short videos would be the best option to provide.

Maintainance activities and refactoring should be a ticket on your board. it is like with a house, in order to keep it clean all the time we need to maintain a clean environment and just clean by little consistently. If we will wait till it gets messy and clean after, most of the time it will be messy, and only a few days after cleaning it will stay clean.

So the maintenance and refactoring activities should a ticket on your board every sprint and we need to do it consistently.

This is it for a clean test-automation framework. Please share in the comments what worked for you or what kind of mistakes we should avoid. Thank you!

Software Developer, Java Instructor

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store