Wednesday, May 26, 2004 11:15 AM
Is it productive?
How much time do you typically spend debugging your code? With a good suite of unit tests, this time can be vastly reduced, especially when writing your tests closely to the production code, preferably shortly before ("test-first"). Some developers using this technique don't even remember how to operate a debugger... ;)
Additionally, writing unit tests also test the modularity of your design and therefore can help you find and fix "design bottlenecks" early in development.
So, yes, you actually might spend half your development time writing and maintaining tests - and still reduce overall development time.
Is it efficient?
As someone else already stated, the quality of the tests only depend on your ability to write them. And no, tests will probably never find *all* problems with your code. On the other hand, writing good unit tests actually isn't that hard to learn, and teams doing extensive unit testing consistently report massive drops in bugs encountered in production (down to only a handfull of bug reports a year).
Be aware, though, that unit testing is not the only thing there is to testing. At least equally important is acceptance (system) testing, that is, testing that the whole product is doing as expected (instead of single units). I would think about starting with writing those tests, possibly using FitNesse.
Also take a look at TestDriven.com for more info.