It seems as though the .NET developer community is becoming more polarized regarding their thoughts on the value of Unit Testing. I see it as a split between those that are dogmatic about Unit Testing, and those that are in denial that it has any long term value.
Some of this was spurred on by Cashto’s “It’s OK Not to Write Unit Tests” post, but I think that sentiment has been brewing for quite some time and it just hadn’t properly been put into words.
I think Cashto had some valid points and that in certain instances, Unit testing and TDD can become cumbersome. In my opinion, the following would need to be true to get away with not Unit Testing.
- You have the final say on which features go into your software and your customers can handle losing features between releases.
- Your software addresses a niche with a small customer base.
- You have nothing but highly skilled developers working on the code.
While some may consider these three conditions to be unrealistic, there are certain small lean startups or small consulting projects that can operate under these assumptions.
The problem with the .NET community’s reaction to cashto’s post was that the dogmatic individuals immediately dismissed it and the ones in denial unconditionally embraced it. The dogmatic strictly believe in a test first methodology, and are quick to dismiss any notion of the contrary. The irony is that their dogmatic attitude is reactionary to the “no testing” attitude previously espoused by many in the community, especially those most closely associated with Microsoft. Those individuals who fully embraced cashto’s post and cried “Unit Testing is Dead” are the ones most often in denial that never really gave it a chance. These individuals may have dipped their toes into Unit Testing years ago and quickly gave up without putting enough initial effort or seeing any results.
For those of us who fall in the middle, the path has become unclear. The dogmatic approach can be off putting, especially when faced with the often harsh attitudes of those espousing it. Staying in denial, however, is not an option for those who have been in the trenches and seen more than a few nasty bugs caught with good unit tests.
I have chosen to look outside the .NET community and see how the Rails community has dealt with this issue. I suspect that many of the disagreements are actually more technical in nature than most people realize. More on this in a future post.