Code Coverage Limitations¶
Code coverage measures which code paths executed during testing, not whether the tests verified correct behavior - high coverage with weak assertions provides false confidence, while meaningful tests might not maximize coverage metrics.
Tension Addressed¶
Coverage vs. Quality
Recognizable As¶
Coverage reports showing 90%+ but bugs still reaching production; tests without assertions; assertions only checking "no exception thrown"; coverage mandates without quality review
Canonical Sources¶
Marick, "How to Misuse Code Coverage" (1999); Fowler, "TestCoverage" (2012)
Transfers To¶
Goodhart's Law (measure becomes target); vanity metrics in analytics; audit compliance vs. actual security
Coverage is a necessary but not sufficient condition for test quality. A line is "covered" if it executes, regardless of whether the test verifies its behavior. The metric is useful for finding untested code but cannot distinguish meaningful tests from trivial ones.