Somebody does not understand unit testing!
I have worked on several projects that made use of unit testing. One such project relied heavily on JUnit. It’s a fairly straightforward technology and technique to integrate into the development cycle of a project. At least I thought it was. Today I read a posting at Slashdot from somebody who did not understand how to apply unit testing.
Somehow, this person got the idea that developer-written unit tests completely replace testers. That is, of course, a completely stupid thing to be doing! Testers have a very important role to play within the successful deployment of a software system.
Developer-written unit tests force the developer to think about the code they are writing. It makes them think about how it may be misused, or what unusual values it may have to handle. It is often better for them to consider such issues right away while producing a piece of code, rather than ignoring the problem, letting a tester or user discover it later on, going through the process of filing a bug report, and then actually fixing the problem. Problems are less expensive to catch earlier on. The earliest time that that can often happen is when the developer is actually developing the code for the first time.
I think that the Slashdot poster also missed the importance of unit tests when developing new code for an existing system, or modifying existing code. Unit tests provide a very quick and useful way for developers to ensure that a change they just made does not negatively affect some other portion of the system. Of course, further testing by testers is necessary to ensure that other problems have not crept up.
What I’ve seen in practice is that proper unit testing results in a productivity increase for both the developers and the testers. Some initial effort by the developers to write unit tests helps ensure the software they are producing is of a higher quality, while also being more maintainable. Likewise, many relatively minor problems are caught right away by the developers, who can then immediately fix them. The testers can then focus more of their time on serious issues, rather than minor errors that are easily detected and fixed.
So developer-written unit tests would, in my experience, raise the productivity of everyone. The developers end up putting out code that is of a far higher quality, all with relatively little overhead. These developers can also use these tests later on when modifying existing code, to help ensure they don’t break anything else. The testers, on the other hand, no longer are bothered as much by minor issues and bugs, and can thus focus their attention on verifying and validating the more complex aspects of the system. It’s often a win-win situation for all. The developers and testers end up being more productive, while the customer gets better software.