John Lam 1997 — 2026

How to misuse code coverage

Steve Makofsky Steve points to this excellent paper by Brian Marick that focuses on an important source of bugs: faults of omission. Your code coverage tool can only tell you about code that exists that wasn’t executed. It can’t tell you anything about code that you need to write - that is code that fixes faults of omission. The simple rule of thumb that Brian proposes is that:

If part of your test suite is weak in a way coverage can detect, it’s likely also weak in a way that coverage can’t detect.

I strongly recommend that all developers take a close look at Brian’s article. I had to re-read his article a few times to get what he’s saying, since his recommendations are quite abstract. But you won’t regret the time invested.

I’m now thinking about integrating a code coverage tool into my NAnt/NUnit build system. There doesn’t seem to be any open source CLR tools yet - I’m going to take a quick look at Rational’s Quantify and NuMega’s DevPartner products to see whether they can be integrated into an automated build system.

3 archived reader comments

Andreas Haeber (2003-07-31)

Don’t you mean Rational PureCoverage instead of Rational Quantify?

Also, I guess it should be possible to accomplish this task with Rational’s test-tools. Look for Rational PureAPI (for .NET and Java2) and PureCoverage API (unmanaged c/c++). There is also a great bunch of command-arguments you can send to them :)

Yves Reynhout (2003-08-06)

AutomatedQA.com => AQTime .NET Edition

Mark Levison (2004-02-18)

There is a small open source tool called NCover -its available in the GotDotNet workspaces. I’ve no idea how useful it is yet, as I’ve not had time to experiment.