Member-only story
Are Your Unit Tests Getting Redundant? Here’s How To Write Them Effectively
A compelling reason for less work in a busy life

There are plenty of things to do in life. Anytime we can cut ourselves a break, it is easy to embrace it as a welcome change. An engineer’s responsibilities around unit tests are no exception to this rule.
From my observation, I have seen far too many unit tests across projects, companies, and domains, which are redundant. Redundantly redundant. These tests incur a greater maintenance responsibility and are more susceptible to unnecessary failure.
In the spirit of having plenty to do in life and our jobs, the real virtue of good work comes when we can work smarter, not harder. In this article, I will break down the common errors I see in unit tests and unravel how to simplify your approach while maintaining the same level of coverage.
The Point of Unit Tests
It can be easy to lose sight of the big picture during the day-to-day grind of writing unit tests. To level-set our understanding, let’s take a moment to review how the industry recommends we unit test and the purpose they serve.
For the sake of illustration, consider this diagram representing a function as our unit under test: