“I am ready to write some unit tests. What code coverage should I aim for?”

Here's a nice "story" about code coverage from the Google Testing Blog.

Testivus on Test Coverage
Early one morning, a young programmer asked the great master:

“I am ready to write some unit tests. What code coverage should I aim for?”
The great master replied:
“Don’t worry about coverage, just write some good tests.”
The young programmer smiled, bowed, and left.

Read more on the official blog »
Code coverage is an interesting metric which I found particularly useful as an indicator of "trust in your tests". See my according post here.

Posts you might also be interested in..

Credits: Hoctro | Jack Book

2 Comments:

Peter Gfader said...

I am not a strong believer in Code coverage, especially because it is really easy to get high coverage with tools like Pex or by just calling methods without having Assert statements ;-)


A good code review is 200% more value than looking at code coverage stats.

A good code review consists of:
Change 1 line of application logic, see if 1 test fails.

Juri Strumpflohner said...

I agree, but still having code coverage stats in place can help you quickly spot places your tests don't cover: http://goo.gl/5lkO

But sure, if one tells you he got 80%+ of lines of code covered by unit tests doesn't mean his unit tests are written appropriately. That is when the a good code review comes into play.

Post a Comment