Are Unit Tests Necessary?

At work today I came across a project that had not written a single unit test for their new code and wondered what the hell they were doing. Nothing unusual except that apart from the usual excuses about time constraint etc., they had the guts to challenge the value of unit tests. I did not believe what I heard and for a moment wondered if I had gone through some kind of time capsule when I was visiting the pyramids in Cairo last week and come back in a time before unit testing was invented. But a quick glance at the date on my watch ensured me that it was still 2010.

The only comforting thing about this is that as long as there are projects like this, there will be plenty of work for software consultants to clean up the mess. Just a pity that the first couple of weeks will be spent writing unit tests to be able to start refactoring the code. Good thing that writing unit tests are pretty fun and addicting, or to quote one of Kent Beck’s tweet earlier today “… tests are like potato chips”.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.