Test Coverage IS important...
This fellow said:
"I would much rather aim for 100% test-driven development than aim for 100% test coverage."
But I fear he's missing the point. If I'm only testing 1% of my code paths, 100% of the time, what am I accomplishing? Squat.
As my boss has said, adding a non-intrusive code coverage tool to an already successful unit-testing strategy can absolutely find gaps in coverage that staring at the screen just won't find.
But juxtaposing 100% TDD with a 100% coverage goal doesn't make sense. They are complimentary, parallel even, but not opposing goals.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
BTW, TDD doesn't ensure 100% code coverage. Actually, the term TDD is somewhat of a misnomer, and Example Driven Development is a more term to describe the actions going on.
Any professional tester will look at tests appearing in a TDD projects and say "OK, good start, but where are the security, performance, scalability, etc tests ?"
IMO, TDD is an excellent design tool, allowing us to express in no uncertain terms (?) the behaviour we want - and then implement. Its just like a safety net, it'll keep you from nose-diving into the ground when changes occur, but its still got lots of holes - testing wise.
I guess its like a joiner, who has a wide range of tools in his bag. For some jobs, you may be able to take a "good enough" for the price approach, yet you may also get another job where not applying a little vigour may result in disaster.
Stuart.
http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=881a36c6-6f45-4485-a94e-060130687151
Comments are closed.
TDD's rule is "write no line of code without a test to force its existance." So that pretty much guarantees 100% statement-level coverage. The rule also applies to "if" statements, etc., so you don't write an "if" statement unless you have a test to force it to exist - pretty much guaranteeing 100% branch-coverage.