Another survey and another set of interesting results. For the last couple of weeks I've been running a survey on this blog asking you to indicate if you use unit tests A) pretty much all the time, B) once in a while, or C) never. And within the last option, I gave you the opportunity to indicate if you're not using unit tests because you don't know what they are or because simply don't think you need them. Clearly, I expected a large number of you, dear readers, to fall in to categories A and B, but just as with the "why do you code" survey, you've surprised me.
Frankly, I'm still trying to decided whether these results represent humor responses or painfully honest feedback. I find it hard to believe that in this day and age of TDD and Agile buzzing all around that you can escape knowing what unit tests are. Still, 9% of you indicate that is the case, so clearly it is possible. More shocking than not knowing about unit tests, though, is the large group of respondents that said they know about unit tests but don't think they need them! Almost 40% of those that answered fell in to this category.
That raises the most interesting follow-up question: Why don't you think you need unit tests? Clearly their benefits are well extolled across the interwebs, so it shouldn't be necessary to point out how unit tests help you write better, more maintainable code. Knowing that, though, many of you still (apparently) rely on manual testing. Are unit tests still to hard to integrate in to your programming work flow? Do you generally write perfect code ([cough]...liar)? Sound-off in the comments and let us know.
And just to be clear and set the tone, I don't unit test all of my code (not nearly to the degree I know I should). Largely it's because I'm a web developer and I've always found it too hard to create unit tests for code that spends most of its time reading or updating databases. How much does a unit test help when you start mocking everything out? Still, I'm getting better and I increasingly depend on unit tests for writing better code.
Regardless of your answer, thanks to everyone for participating in another survey. The next survey is already up, and with summer approaching, I'm asking how often you manage to leave the computer and spend some time outdoors. As always, be honest.