Skip to main content

Command Palette

Search for a command to run...

Do This First To Develop The Best Automation Framework

Updated
6 min read
Do This First To Develop The Best Automation Framework

Automation framework is the building block of any automation project and the right design and development of the framework would ensure the success of the project. So like any product, a considerable amount of time and effort is required to build the framework, starting from the design aspect.

Automation frameworks are mostly integration of libraries and tools, which helps to perform a definite task and analyse the outcome. It is very important to keep tests separate from the framework, we will look at how to design using some commonly used design patterns and best practices. Before designing the framework, it is imperative to define the goal of the Automation. A definite goal will help the team to design the automation framework and eventually will help to measure the success.

Some of the key parameters that need to be considered before building the framework are choice of language, other frameworks integration, design patterns, different logical layers, scalability, types of tests to be covered, DevOps integration, tools integration, resource skills required.

So, let’s plan different elements…

1. Different platforms supported: Your SUT may be supporting different platforms. For ex: Desktop, Mobile, POS etc. So, it is vital to understand the landscape of the application that is under test.

2. Different OS supported: If you are going to test the application which supports multiple OS then this is an important factor to consider first. For example: Desktops: Windows, Mac etc, Mobile: iOS, Android etc.

3. Different Browsers supported: If your application needs to be tested in different browsers like Chrome or Safari then this needs to be factored during the planning stage.

4. Type of Application: This information is vital for the planning and design of the automation framework. As applications are more complex and run on different platforms, OSs and devices, it is important that we carefully list out all the details of the application.

Technologies used to build the application- In case of Mobile application whether the application is built on Native or Hybrid technology, which cross platform/framework is used to develop the app like React Native, Cordova etc.

What kind of customers the application caters to? — Suppose your project needs to build a framework which caters to only internal audiences, so in that case the most important thing is to keep your cost to a minimum. On the other hand, if the application under test is for external customers like retail applications, then you would like to get the best tools available in the market and cost may or may not be a factor here. Now let’s see some of the different kinds of customers an application can cater to; it may be internal customers, B2B, B2C, geography specific customers etc.

5. Different interfaces supported: It is very important to understand the different interfaces your test will traverse through. Accordingly one should plan the integrations, the choice of tools and factor scalability. Make sure that the integrations are developed as independently as possible and integrate each other with services/APIs.

6. Users demography: Very carefully understand and chalk out the users of the Automation framework. Whether the team is centralised or distributed, the different users of the framework can use it to test different use cases, for example testing team can use for E2E test, developers can develop UT test, engineering team can use to check their product and business team may want to see if the requirements are tested correctly. Or they just want to run the test you have written. For example: if the test will be run by business analysts then introducing BDD will be helpful, or if you want someone who does not have coding knowledge to run the test, you may want to introduce a simple UI to run the test.

7. Reporting: TC mapping, Screenshots, Videos, Logs, Analytics, Dashboards are some of the most important parts of reporting. One can also see if an auto trigger of the email to all the stakeholders is required. It is very crucial to understand the consumer of the test reports, accordingly you may need to plan different reports. Make sure all the artefacts you want to capture are taken care of during designing.

8. Execution Environment: Some of the factors which determine the execution environments are team demography, platforms supported, types of testing(cross browser test, compatible test).

Analysing the correct and most cost effective execution environment, would be a vital activity during the designing stage . Whether your test will run on your personal laptop or cloud based infrastructure, it is important to derive the execution infrastructure based on the above factors.

There are quite a few tools in the market to set up your own cloud-like infrastructures, like Selenium/Appium grid, or simply using Jenkins to fire the test on distributed infrastructure, where you hook devices/browsers in different hosts. But things can be tricky and maintenance will be difficult if the infrastructure needs to be scaled exponentially. So the best way to minimize maintenance, would be to use different cloud solutions like Perfecto, Seetest, Saucelabs, BrowserStack etc. It is recommended to do a detailed evaluation of tools before finalising.

9. Design Patterns:

According to the definition: A design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn’t a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.

So we need to look for an appropriate design pattern for the test automation framework too. Some of the common design patterns in test automation framework are:

Page Object Model: It is one of the most commonly used design patterns where pages are defined by classes and UI elements of that page as variable.

Single Responsibility Principle: This principle states that a class should do only one task and have only one reason to change. This will ensure that less effort will be required to maintain the test scripts and produce a clean code.

Facade Pattern: Facade pattern is the extension of the Page Object model where we combine the actions on different pages to create a scenario/flow. This abstraction helps in better maintenance of the code which may be cumbersome when applying only the Page object model.

Singleton Pattern: There is only one instance per class at any given point of time. With implementation of this design pattern we can ensure that only one instance is created per class for example: loggers, web/appium driver, loading different files etc.

Ideally, one has to combine all the above one to design and develop an effective automation framework.

Before you go..

The above parameters are some of the minimum things you should brainstorm about but depending on the application, SUT or project the points may differ, so you should take a very informed approach towards designing and building your framework, as it will decide the success or failure of the project.

Originally published in Medium