Does unit testing pay off?

Does it really pay off to do Unit Testing? According to a study conducted at Microsoft it does. The study quotes an increase in development time of about 30% in order to get decent code coverage. The benefits are a reduction of bugs found in verification of 20% and a total decrease in defects/LOC of 60-90%.

This also leads to qualitative benefits such as “help me produce higher quality code” and “write solid code from the start” as well as having fewer bugs in areas of the code covered by unit tests.

So, how does this improve the overall productivity of the developer? Assume that a developer spends D % of his or her time on development, including writing unit tests, C % on bug corrections and O % on other tasks. Assume for the sake of simplicity that the developer time is equally distributed between the three types of activities.

Increasing the time spent on development by 30% leads to perhaps 75% less time spent on corrections. Thus the new mix is D’=D*1,3 = 43%, C’=C*0,25=8% and O’=O. The sum is D’+C’+O’=84%. Consequently, 16% is freed up.

What’s your mix between Developement, Corrections and Other? What will your benefits from implementing unit testing be?

About Greger Wikstrand

Greger Wikstrand, Ph.D. M.Sc. is a TOGAF 9 certified enterprise architect with an interest in e-heatlh, m-health and all things agile as well as processes, methods and tools. Greger Wikstrand works as a consultant at Capgemini where he alternates between enterprise agile coaching, problem solving and designing large scale e-health services ...

3 Comments

  1. Pingback: Agile Project Manager : CPP unit test overview

  2. Pingback: Agile Project Manager : CPP unit testing frameworks

  3. Pingback: The evidence is in – TDD works!

Leave a Reply