Unit testing in the enterprise: Five common myths dispelled
searchsoftwarequality.techtarget.com
searchsoftwarequality.techtarget.com
I wish the author would elaborate on that statement. I want supporting evidence, even if it's anecdotal.
When people claim to be dispelling myths, I'd really wish they would do so with fact/numbers (ever see myth busters, they don't just dispel by telling you). I'd really like to see some numbers from the TDD folks on number of bugs found via TDD and it's effectiveness. And I don't want the story about the one bug found that saved them (just like that friend that lived because they were ejected from their car in an accident (fortunately they weren't wearing their seat belt)).
I don't think I've personally encountered that. Plenty of bugs at compile time or during regressions, but nothing where I could even imagine a unit test saving me.
I think the true value of unit tests is documentation. Instead of writing documentation that says, "Hey, this function should do this", you're writing code to do that, which is usually a pretty good idea. Executable documentation is the way to go. It's a very lisp-y idea.
That said, I'm not fond of the author's implication that unit testing will save you from cascading failures and make you a better programmer. He even says it's not a silver bullet, only to turn around and say it's the most magical thing to happen to software productivity since the invention of the keyboard.
It seems to me that the productivity gains are from forcing your developers to actually understand the code they're writing and interfacing with, but personally, I don't think I'd trust or hire someone who wasn't proud enough of their work to do that on their own.
Where I work, we have unit tests that are all hand-coded. Even with that, it takes half an hour to run through the full suite - too long to do on any minor change, but still manageable when preparing a sandbox for checkin.
If we added in automated tests, we would have many times the number of tests, with a corresponding increase in the time taken to make them run. If you can't run unit tests quickly, their value is reduced.
I personally feel that a well-designed test framework should test all of the common use cases, some obvious edge cases, and should be easily adaptable so that when bugs are found, you can readily create a unit test that reproduces the bug, preventing regression.
I'm curious as to how others here decide which unit tests to write.
Maybe you could offload/parallelize the test runs -- eg to a on-demand virtual hosting -- so as to minimize test run time as an issue?