Development Workflow

Code Coverage: What the Numbers Do and Do Not Say

Interpret line, branch and path coverage without treating a percentage as proof of correctness.

Overview

Code coverage reports which parts of source code were executed while a test suite ran. It can reveal untested areas, but execution alone does not prove that assertions are meaningful.

Understand coverage types

Line coverage records executed lines. Branch coverage considers decision outcomes. Path coverage is more demanding because combinations of branches can grow rapidly.

Use coverage as a diagnostic

Look for important business rules with no tests, untested error handling and code that is difficult to reach. Review uncovered code according to risk rather than chasing a universal percentage.

Pair coverage with mutation testing

A line can execute while the test would still pass if the implementation were wrong. Mutation testing helps evaluate whether assertions detect selected code changes.

Report honestly

Document exclusions and generated files. Avoid changing thresholds simply to make a dashboard green, and never compare percentages from different configurations as if they were equivalent.

Share this page Help other developers discover this resource.