1.7. When Should Testing Be Automated?

The discussion about whether and when testing should be automated has been going back and forth for many years. When considering this argument, it is important to remember that testing actually covers a number of different techniques, and as such, this question cannot result in a simple yes or no answer. Instead, you need to look at every feature and type of testing which needs to be performed and decide on a case-by-case basis. But how do you decide?

First, you need to consider what you are asking. You are trying to decide if a test you need to perform should be done using script\code and made into an automatable, repeatable test or if you want to manually perform the test each time you change something. You then need to consider the type of testing you want to perform and consider the cost of automating the process as opposed to the cost of repeating the test. You need to consider the cost of maintaining the automated test compared to our manual test. Finally, you need to think about the cost of it going wrong and a bug ending up in production. With these factors considered, you can decide if you think the cost of automating is worth the cost and effort compared to manual testing.

With that in mind, let's consider some initial problem domains and the general thought process when faced with the question of whether or not to automate.

When unit testing, our main focus will be on the business logic and process. Arguably, this is the most important ...

Get Testing ASP.NET Web Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.