What is the cost of avoiding unit testing and the cost of software bugs?
More than a third of the cost of software bugs – over $25 billion in the US alone – could be avoided if better software testing was performed in the initial stages of development?
The cost of inadequate infrastructure for software testing in the United States was $59.6 billion, or about 0.6 percent of US GDP, according to a report by the National Institute of Standards and Technology (NIST). Over half of the costs are borne by software users and the remainder by software developers and vendors.
According to NIST, while software bugs can’t be completely avoided, more than a third of this cost could be avoided if better software testing was performed and bugs were found during the development stage. Based on 2010-2011 labor costs, the cost of preventable software bugs has increased to at least $25.8 billion in the United States alone.
So, how does this break down? According to NIST’s estimates, approximately 10 percent of computer programmers’ and 35 percent of software engineers’ time is spent debugging and correcting errors. According to NIST, this is equal to at least 302,450 full time employees engaged in testing and debugging activities, representing approximately one-fourth of all computer programmers and software engineers in the United States. Half of labor when developing software is spent on testing.
The median salary in 2010-2011 of American computer applications software engineer was $85,430 and the median wage of computer systems software engineers was $92,430. At the lower wages of American computer applications software engineers, assuming that no additional employees are required to engage in testing and debugging activities, this yields a minimum cost of at least $25,838,303,500 spent on debugging and correcting errors per year.
Currently, over half of all errors are found “downstream” in the development process, after the code has already been sent to QA or during post-sale software use. However, as the above shows, by engaging in development practices that are more likely to find bugs upstream, such as unit testing, overall costs can be reduced.
Ward Cunningham’s First Law of Programming states that “lowering quality lengthens development time.” According to Cunningham:
Quality software takes the least amount of time to develop. If you have code that is simple as possible, tests that are complete and a design that fits just right, additions and changes happen in the fastest possible way because the impact is lowest. Consequently, if you hack something out, the more you hack the slower you go because the cost of addition or change grows with each line of code.
By preventing bugs in the development process, long-term costs are saved. The average lifespan of a software system can be decades. According to David Laribee, “The idea that you have a development team that completes a project then throws it over the wall to a maintenance team is fundamentally flawed.”
Hence, if you unit test, you will:
- Find bugs quicker
- Provide confidence in your code
- Send less bugs to QA
- Release higher quality software
- Save your company lots of money.
 The Economic Impacts of Inadequate Infrastructure for Software Testing. http://www.nist.gov/director/planning/upload/report02-3.pdf