“How many bugs have your unit tests found? And why didn’t they find the one that’s currently killing our production? See? This proves that unit testing doesn’t work. It’s just a waste of money. My money,” said the boss. Of course, not my boss.
That’s actually a pretty valid point. How do you prove that unit tests that I have written have avoided a lot of problems? Unexistence is hard to see. Management has to be a little bit religious here. Defects found by testers are measurable because they are officially reported. Everyone can see the issues chart, you hear about them during meetings.
But who has ever reported how many bugs he has avoided thanks to unit tests?
I am not a very religious type. Quite the opposite. That’s why I don't feel comfortable advocating unit tests. I just can’t find any measures, numbers, or graphs to show that would clearly visualize the benefits. The more I think of it, the more it gives me the impression that we should start a movement against unit tests.
Let all bugs rise and ruin the production. We will count them and put them into glass jars with a little help of unit tests. Add salt, oil, sergeant pepper and serve it to the management with a colorful defect burndown chart. Their oak tables full of canned bugs are the best evidence they can imagine. When you tell them that it will never happen again if we first write unit tests and then go to production, they will make you the employee of the week. Maybe even of the month.
Don’t worry. They will forget and it will come back again. Decreasing budgets, missed deadlines and always-more-important tasks will keep unit tests in the waiting line. Then you know what to do. Corkboard misses your photo. Let them out again! Get high with a little help from our friends.