Value of Test Automation
Tags: automationtesting, refactoring, agile, continousdelivery
Published: 2021-12-05 14:48:42

As I am currently reading Complete Guide to Test Automation: Techniques, Practices, and Patterns for Building and Maintaining Effective Software Projects book, I decided to summarize the value of the test automation chapter and I really recommend reading this book.

## Test Automation Need

The most common answer is to reduce the time it takes to test the software before release. Reaching the goal of reducing the manual test cycles usually takes a pretty long time to achieve.
The transition from the traditional Waterfall approach to the Agile approach contributed a lot to the need for test automation. The quickly responding to customers’ feedback become much more valuable than sticking to the original plan.

**The Software Complexity Cost**

Every new version of a software, new features are added. As new features are added, the software becomes more complex, and when the software becomes more complex, it becomes harder and harder to add new features to it without breaking anything. Some of this added complexity is unavoidable. But most of the time, most of the complexity in a software exists because features were added quickly without proper design; lack of communication inside the team; or due to a lack of knowledge, either about the underlying technology or about the business needs

## Two factors helps to keep a constant complexity cost:

- Make the cost of running the ever-growing regression test suite negligible.

Keeping the code very easy to maintain.
The first factor can be achieved if most of the tests are automated. However, the second factor is mainly affected by the accidental complexity, and it is much more challenging to control.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/907jug37nnc40hqk96tj.png)

However, in most cases in the real world, due to the accidental complexity, the complexity rises more steeply than linearly as we add more and more features.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4stc8zinpjd4ldqq2kkg.png)

So it seems that it is not feasible to keep developing new features with a steady cost over time, because accidental complexity is unavoidable. The solution for keeping accidental complexity under control is called refactoring.

## Refactoring

Refactoring is the process of enhancing and improving the code structure without changing its behavior. In other words, it allows us to get rid of accidental complexity.
But even with automatic refactoring tools, the developer can make a mistake, and introduce new bugs in the process, breaking existing functionality. Therefore, refactoring requires comprehensive regression testing. So, refactoring helps keep the accidental complexity under control.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/odyjkaezogwkbkhlyapf.png)

Test automation is also related to the architecture of the product, the business processes, the organizational structure, and even the culture besides quality and productivity.
All of these aspects have an effect on the test automation. But you can also leverage the reflection of these effects in the test automation to change and improve any of these aspects back.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hl2ow224hrzxnj5rm3th.png)


## Conclusion
The value of test automation can not be denied for continuous integration and while using agile methodology, the regression testing and continuous refactoring can guard for the team productivity. It is important to keep an eye on the software complexity cost to be far as much as you can from the high maintainability cost.