I'm a consultant and I am going to introduce unit tests to all developers at my client site. My goal is to ensure that all new applications should have unit tests for all classes created.
The client has a problem with high maintenance costs from fixing bugs in their existing applications. Their applications have a life span from between 5-15 years in which they continuously add new features. I'm quite confident that they will benefit greatly from starting with unit tests.
I'm interested in the effect of unit tests on the time and cost of development:
- How much time will writing unit tests as part of the development process add?
- How much time will be saved in maintenance activities (testing and debugging) by having good unit tests?
Best Answer
There is some very interesting research about this. Read the following whitepaper:
Realizing quality improvement through test driven development: results and experiences of four industrial teams
The whitepaper and others research from one of its authors, Nachi Nagappan, are discussed here: http://research.microsoft.com/en-us/news/features/nagappan-100609.aspx
Additionally, Jason Gorman has proposed such an experiment for the Software Craftsmanship conference this year. He's been trying an experiment creating the same application using a TDD and a non-TDD approach and he's recently blogged about his results:
It will be interesting to see the full results of this experiment when more people perform it.
From the whitepaper above: