Link Details

Link 13479 thumbnail
User 194326 avatar

By jponczak
via codign.com
Published: Feb 13 2007 / 09:28

Code coverage is a way to measure the level of testing you've performed on your software. Gathering coverage metrics is a straightforward process: Instrument your code and run your tests against the instrumented version. Most developers understand this process and agree on its value proposition, and often target 100% coverage. Although 100% coverage is an admirable goal, 100% of the wrong type of coverage can lead to problems.
  • 10
  • 0
  • 1244
  • 107

Comments

Add your comment
User 179375 avatar

Ricky Clarkson replied ago:

0 votes Vote down Vote up Reply

I mainly use coverage to tell me what classes I'm not using - I sometimes run a coverage tool with the normal run, rather than automated tests, for this.

It's important not to be afraid of low coverage - that can just imply that the code in question changes, or changed, quite rapidly, or possibly that the code is hard to test. For example, code that instantiates a JDialog can't be run in headless mode, but it often isn't worth mocking JDialog to make it testable - the indirection hurts. Also, don't be afraid to delete tests. I deleted one today!

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (10)



Voters Against This Link (0)