Why Unit Testing Shouldn’t Be Overlooked

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Most people in the software industry understand that unit testing is beneficial and can reduce the amount of time needed to debug complex problems; however, finding software where unit testing has been performed always seems to be a challenge.  Unit testing allows software developers to test an individual software requirement, method, or module, to determine if each unit performs as expected.  Ideally, each unit test is specific to one task, allowing a software developer to quickly drill down to identify the source when test failures occur.

If there are obvious benefits to implementing unit tests, what leads to developers straying from this path? 

First, the cost of third-party tools specific to building unit tests might keep some developers from committing; however, the time savings alone would allow these tools to pay for themselves. 

Second, lacking of understanding of how to build effective unit tests may be deterring others, though there are many samples available to learn from on the Internet, and in other materials on the topic. 

Thirdly, the time investment to write unit tests also discourages software developers.

These concerns are all reasonable; however, creating unit tests does not have to be extraordinarily time consuming, and authoring and executing tests can lead to a very valuable learning experience, such as how to break code down in to smaller, more well defined tasks, allowing problems to be solved more efficiently.  The implementation of unit tests will also help save you and your clients both time and money. 

While there are multiple formulas projecting the costs of finding defects at different stages of the SDLC, all projections point to a large gap between the testing phases, where unit testing should be performed, and release phases.  The further into the SDLC a defect is found, the higher the associated cost to remove the defect.