DEV Community

Hiren Dhaduk
Hiren Dhaduk

Posted on

Is Unit Testing Overrated?

Throughout my career, I've come across a lot of colleagues who think unit testing is overrated. This bugged me because I love unit tests. I believe they form the backbone of your test automation strategy.

However, I later realized that this was due to the reason that a lot of them weren't doing it right! Once they started doing it right and saw the difference between unit tests and several other tests, things started changing. Especially what type of tests to perform at required places, a lot of them got to know the difference between beginning things without the real execution and understanding it through personal experiences.

Anyways, if you're one of those who think unit tests aren't worth the attention they get, think twice. Here are my three primary reasons for which I won’t underestimate unit testing in my test automation strategy.

1. The proactive need:

Detecting the bugs at the very initial phase is one such proactive step. A lot of software and apps are built without knowing the bugs residing at their quiet corner and turning out to be massive disasters later.

For avoiding such potholes, unit testing works as the backbone of automation testing. For the organization’s building highly scalable software products, it is hard-earned efforts getting veined if the detection of bugs happens at the critical stages.

Unit testing does the early detection of bugs, which profits the overall project development and puts the organization’s efforts into optimizing the process with less time and better quality.

2. The AAA pattern:

Unit testing follows the strict AAA pattern stating Arrange, Act, and Assert section. These three sections regularly work for arranging the collaborator modules, preparing for the results that can be observed, and checking whether the result is matching the expectations.

Unit testing has this distinct pattern for making test code easier since it better separates the testing stuff and related steps. It predominantly helps in performing regression testing smoothly.

3. Refactoring & flexibility:

Developers won’t find it difficult to implement the changes in existing code because of the refactoring facility of automated unit testing. Test automation allows the developers to update the software without impacting the design and overall quality of the software.

Again, it keeps everyone informed by pointing out the bugs in separated modules. Even novice developers can understand the code. Not to mention the quick fixing quality of unit test automation, which makes software products favorable to the users.

What has been your experience with unit tests? I'd love to know. Connect on Twitter @HirenDhaduk_ to carry this conversation or comment below.

Top comments (2)

Collapse
 
joerter profile image
John Oerter

I think it follows that when people struggle to write unit tests, or don't understand how to use them properly, they create reasons why they're not valuable and not worth writing. I rely heavily on unit tests and don't believe they're underrated.

Collapse
 
hirendhaduk_ profile image
Hiren Dhaduk

I second what you're saying!