Does high Code Coverage mean high test quality?

From CitconWiki
Jump to: navigation, search

It's possible to write a test which achieves extremely high code coverage for a system yet doesn't test the system at all.

We looked at ways of preventing this, and what other measures one should use to ensure the effectiveness of your test suite.

  • Code Coverage is a negative metric - we can only deduce that uncovered code may contain errors and not that covered code is error free.
  • Code Review should be used to ensure that tests actually test and are not just propping up the coverage metrics
  • Mutation testing, using a tool such as Jester, will also uncover tests which are "weak"
  • Clover2 exposes the list of classes each test covered ("per-test coverage") which can uncover power tests that possibly cover a lot of code yet have little value since they are so ufocused
  • Discussion of whether the number of assert statements a test has could be an effective measure of test quality?

References:

* Jester
* Crucible, Code Review
* Clover2