I am just returning from a seminar on Unit Testing organized by BASD with the association of Sofia University. The event gathered more than 170 people which make it one of biggest one for the recent months. It is obvious that Bulgarian developers are extremely interested in the benefits and implementation of unit test framework. However on a speaker question how many of them are using unit tests in their current project only 3 percent raise their hands.
While many people think that unit testing should be incorporated in the project schedule in order to employ them I personally think that this is responsibility of every single developer. Before unit testing gets popular and enjoys real attention from project managers the developers must prove their actual value. It is possible that not everyone will write good unit tests or be able to get to the habit of writing them. Actually this may get even worse. If you require unit test to be written and the developer is not feeling good about it he may write bad and too simple unit test that never fail. This can be total disaster since you, as a project manager, will get the false sense that everything is bug free while it is not. A possible solution is to require formal code reviews for unit test code. It may be also possible to get each developer to write unit test code to his colleague changing their roles periodically. I am particularly interested in the last idea. Have you tried it in some of your projects? I think I will give it a try sometime soon.