Rory Primrose

Learn from my mistakes, you don't have time to make them yourself

View project on GitHub

Is there a point to code coverage?

Code coverage is a concept that is often misunderstood and misused. It gets some criticism every once in a while because of this.

The most common misconception is that code coverage is a measure of code quality. The name code “coverage” also makes it easy to assume that it is a metric regarding the exhaustiveness of test effort. Neither of these are incorrect.

My definition is that code coverage is a measure of what you haven’t tested. Nothing more, nothing less.

Just because something is covered by a test does not ensure that the code is either of adequate quality nor that all possible scenarios are tested for that code. If it isn’t covered though then it isn’t tested and needs some attention.

Written on November 18, 2009