EvilRob.org -> Weblog

Sysadmin Field Notes

First good argument for 100% code coverage I've seen

September 12, 2006

Eric Sink wrote today on advocating the use of code coverage.

I'm definitely a strong advocate of automated testing and code coverage measurement, but I've always been in the "mandating 100% coverage is pathological and pedantic."

I still think it is, but at least Eric presents some good arguments as to why it can be useful.

My main argument against it is that this is just one sort of code coverage metric. Tools like Jester produce a different coverage metric. You can probably dream up others. "Lines visited" is a very one dimensional metric. I think I'd rather have 75% coverage, but have the hairiest, ugliest lines of code tested in several scenarios. This sort of metric doesn't give you credit for that.

Code coverage under unit tests is interesting, but only to a point. It's also very interesting to add code coverage to the application while you run automated functional or integration tests against it.

In short there are all kinds of interesting tests and metrics available to look at, and I'd rather look at those with the time it takes to get the app from 75% to 100% coverage.

Posted by rmeyer at 9:29 PM

This is Rob Meyer's weblog, a weblog focused on software development and system administration based on 10 years of experience. Want to explore further? You can find out more me or see the rest of my website.

Wondering if I've written on something in particular? Try searching:

You might want to take a look at some of the more requested postings (as judged by incoming traffic):

Want more? Subscribe to this site or contact me at rob at big dis dot com.

See my writings on:


Powered by Movable Type | Technorati Profile