Building a Test Automation Strategy
Tags: devops, github, cicd, cloud
Published: 2022-09-12 12:57:09

Test automation can seem daunting as there are many different areas to focus on. Finding the right starting point can be challenging at first. In this blog series, we share our experiences in starting your own test automation effort.

This is the first article of a blog series which consists of four articles. The other articles cover the following topics:

-   Volume 1: Building a test automation strategy
-   [**Volume 2: Building a test automation team**](https://blog.thundra.io/series-2-building-a-test-automation-team)
-   Volume 3: Choosing the right testing framework
-   Volume 4: Knowing when to automate tests

## Why Do We Automate Tests?

If product quality is one of your main concerns for an application,  [**test**](https://en.wikipedia.org/wiki/Test_automation) [**automation**](https://en.wikipedia.org/wiki/Test_automation)  as part of your standard daily development practices has key importance and effect. When tests are automated in a wise and timely manner, developers (and management) can feel confident that they have a fully tested product while serving end-users in production.

Test automation has an upfront cost and does take time to set up and develop. But this investment pays off in the long-term by reducing workload, eliminating manual errors, bringing accuracy in testing processes, and saving money and/or time.

If you embrace the principle of “[**Fail Fast, Fail Often**](https://www.software.ac.uk/blog/2020-02-27-continuous-integration-fail-fast-and-fail-first)” then it’s a good idea to opt for automated testing over manual testing. The importance of automation becomes ever more visible when your codebase rapidly grows.

Automation helps you spend less time on repetitive tasks, which enables you to tackle more challenging issues. Additionally, automation is the only way to cope up with the trend of faster release cycles without sacrificing quality.

## Building Our Test Automation Strategy

It’s incontestable that modern application teams need to automate their tests: The world has changed. End-users would uncover defects in applications at least a decade ago, but now, they’re uncovering not only bugs of applications but minor slowdowns as well – and this is unacceptable.

Test automation can save us from many defects going into production, and allow us to understand our code behavior parallel to the quality of our tests. But to begin, we need a set guide to implement test automation. Below are the constituent pieces of a test automation strategy that will enable you to thoroughly prepare a runbook.

### Define the Scope

It’s important to set specific goals and timelines for both completion and for intermediary milestones before starting to test a software application. These should be listed out on paper for each of your objectives and milestones. By doing this, you are defining the scope of the testing, which acts as a guardrail and keeps you on track.

However, it’s not always easy to define the scope of your testing. You might ask yourself questions such as when and which parts of the application you should test, how much testing is enough, etc.

It's therefore important to understand what types of tests make the most sense to include as you define the scope of your testing. Below are some guidelines that will help you set your testing strategy.

#### 1. You need to be crystal clear about what parts of the applications you are going to test.

Sometimes the software testing team will take it upon themselves to preemptively test features that will never be used and that have no value. It is critical for quality assurance professionals to know what needs to be tested and stay within those limits.

These are features that you should focus on as a tester: common-use, the function that is required by law and working with possible vulnerabilities.

By keeping these priorities in mind, software testers will easily be able to identify all the features that need testing. This will also help you identify the necessary test cases that are required to evaluate these essential features. And in turn, this will reduce extraneous work for you and your team, helping you focus your testing efforts on only the most important parts of the program.

#### 2. Actively manage changes.

When you make even a little change to a small piece of your application, it can affect other aspects as well, which means some elements of your test scope would need to be changed or shifted. And this, therefore, means that it’s imperative that your automated tests likewise be altered or shifted in order to continue matching the test scope.

But why is this so important? Simply put, by implementing a reliable testing strategy during the test scope definition stage, you can reduce or prevent possible threats, and make sure that any modifications made are cohesive.

In today’s fast-paced environment, time is often our biggest constraint – and software development teams often struggle to thoroughly test applications. The best long-term solution is integrating automation into the creation process, which can create a medium for testing: creating, scheduling, assigning, and scrutinizing test cases.

Automated testing removes the need for manual interactions by using software to test other programs, which gives testers additional time and freedom to focus on other aspects of the project, along with the certainty of knowing that tests are always handled.

![](https://assets.website-files.com/6294d502b5093e3965b91f4d/62a1f1f35ce6856731a8d6c1_(Series%2520%25231)%2520Building%2520a%2520Test%2520Automation%2520Strategy.jpeg)

Photo by [](https://unsplash.com/@marvelous?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) [**Marvin Meyer**](https://unsplash.com/@marvelous?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)  on [](https://unsplash.com/s/photos/automation?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) [**Unsplash**](https://unsplash.com/s/photos/automation?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)

#### 3. Think about your end goal and focus on your scope.

At first, your testing scope might not be entirely clear. This is understandable, but it will come more into focus if you make sure you form a concrete plan to fully understand what the objectives of your testing processes are. For example, it is crucial to identify the testing processes that your team should be making use of, such as experimental, load, and performance testing.

Furthermore, you will also need to figure out which tests should be done manually and which should be automated. After this is decided, you'll be able to set up a testing environment that can accommodate these processes.

Creating a structured test strategy will help the testing team figure out how to best carry out actions. In addition, investors and customers will have increased clarity on what they can expect from your company.

### Define the Method

Essentially,  [**defining the test automation method**](https://www.qamentor.com/methodologies/automation-methodology/)  means that you’re determining the approach for automated testing. This answers questions such as which tests should be automated when test cases are going to be developed. At this stage, the roles in the test team for designing and reviewing the tests should be defined. The methodology for test automation can be broken into three parts.

#### 1. Roles

While defining the roles for the test automation team, the thought process needs to be clearcut and elaborative. For the best success, all the team members must know and understand who is responsible for each part of the test automation. Every member of the test team plays a significant role to make the test automation strategy work seamlessly.

A test automation platform should be adopted within the organization to enable all team members, such as technical testers, domain specialists, or test managers, to work and collaborate easily each workday.

Depending on the size of the application, company, or organization, defined roles can vary (examples include test automation manager, test automation engineer, test designer, test reviewer, etc.).

#### 2. Process

Likewise, another crucial component is to have a well-defined and structural process for test automation. This process is generally determined by management, who need to ask and answer “when” and “what’s” questions.

While defining the process, it is important to include in the plan when the automated test cases will be developed within the ongoing sprints. In addition to that, we need to determine which features of the application will be tested manually and which will be automated. The timing of those features being ready to be tested is another topic that needs to be taken into consideration.

Lastly, an analysis of the results of the tests will need to occur. This can be done thoroughly by using third-party tooling, but remember to determine the metrics that need to be analyzed.

#### 3. Technology

Figure out everything about the applications that will have automated testing, including determining which technology the apps are based on and whether the test automation platform supports these technologies.

Usually, creating test automation involves a variety of types of applications: web-based, desktop-based, and others. We either get to choose one of the technology types or make sure the automation platform works well with them all.

Additionally, test automation goals need to be described in order to decide which tests are required to be automated. These goals can be reviewed with the team, who can help identify which activities can be automated. Some tests, such as integration or unit tests, are already a part of application development, but there are a lot of tests that can be automated and save time.

### Prepare the Infrastructure

We can expect results as an output of automated tests when they are fed with known inputs. Therefore, to get the expected outcomes, having a stable, safe, and reliable test environment to run test automation is a critical point.

Setting up the test environment can be a challenging task. Before doing anything else, it is important to establish the requirements for the test environment. We should also think about security concerns, like where to store test data, what to do with the test data after the tests are completed, can the data be masked, etc.

### Make the Risk Analysis

When assessing the risks in a test automation plan, it's just as important to consider risk analysis as with any other project considering some key parameters can help produce a useful risk document. The parameters we would look at are:

-   Description – A summarization of what the risk is.
-   Risk Level – The level of impact of the risk on applications. Will it affect availability, usability, stability?
-   Probability – The likelihood that the risk will happen.
-   Mitigation – The step-by-step actions guide to resolve the risk.
-   Cost Estimate – The potential cost of mitigating and not mitigating the risk.

[**Risk-based testing**](https://www.guru99.com/risk-based-testing.html)  is an efficient way of prioritizing the test executions, monitoring, and reducing the impacts of the high risky tests.

### Execution and Management Plan

The process of executing and managing test cases should be defined in the test automation strategy. The execution and management plan should contain procedures and tasks related to the automation of tests.

A good rule of thumb is to pick the test cases that should be automated and run them multiple times to make sure that they run as expected before adding them to the regression suite. Then, define some best practices that make test cases not affected by the changes of the automated system. During automated tests, we can define the interactions between test cases and the elements of the applications.

It’s always good to use a pipeline orchestration tool and a scheduling tool to run test cases in parallel. This saves a tremendous amount of time.

Lastly, this is one of the simplest but important things to do: assign a pass or fail status by the end of the tests’ execution. If the status is “fail,” then we should go to the next step and run an analysis of the failure to understand the reason why it failed.

### Failure Analysis and Optimization

As part of the test automation strategy, it's critical to have a plan for  [**analyzing and resolving failed cases**](https://github.com/marketplace/thundra-foresight), because they can cause unexpected delays that take more time than anticipated. Having a well-defined failure analysis process can save a good amount of time and effort for test and development teams.

Below are some different errors and how they should be handled:

-   Issues with the test environment – Inform the DevOps team.
-   A bug in an application being tested – Flag the bug for the development team.
-   A bug in the automation scripts – Create a task for the testing team.

The pros and cons of the test automation strategy, the results of the automated tests, and the methods implemented for test automation should be documented and reported for the purpose of improvement in the future.

In this way, continuous improvement is applied to the test automation strategy.

## Wrapping Up

Test automation has a foundational place in the  [**DevOps culture**](https://www.runforesight.com/blog/observability-powering-better-devops-collaboration). It helps us save time and manpower in the long run. There is an upfront cost of automating tests, but the investment pays off by drastically reducing the workload.

After deciding to move forward with test automation, the next step is to create a strategy. In this article, we listed the most important tasks needed to be able to craft our own strategy document. In the next article of this blog series, we will be talking about how to build a test automation team.



> Save the date! 🕊️
> On the 28th of September, we are launching Foresight on Product Hunt 🎉🍻
> **Take your seat before we launch on** [**Product Hunt**](https://www.producthunt.com/upcoming/foresight-ci-test-monitoring-for-github-actions) **💜**
[](https://www.producthunt.com/upcoming/foresight-ci-test-monitoring-for-github-actions)

![](https://assets.website-files.com/6294d502b5093e3965b91f4d/631b1da59b02dabd4c193ad6_unnamed.png)