Measure test coverage as the share of lines or branches exercised by tests.
The test coverage is the share of total lines that lines covered by tests represents, expressed as a percentage. The same figure is also shown per 1,000 and as a "one in every N" odds statement, which is easier to reason about when the rate is very small. Absolute counts hide scale — a rate normalises the number so you can compare periods, channels or cohorts of different sizes, where higher is better.
Test Coverage
Test Coverage = Lines covered by tests ÷ Total lines × 100
Test Coverage = Lines covered by tests ÷ Total lines × 100 The test coverage is the share of total lines that lines covered by tests represents, expressed as a percentage. The same figure is also shown per 1,000 and as a "one in every N" odds statement, which is easier to reason about when the rate is very small.
Absolute counts hide scale — a rate normalises the number so you can compare periods, channels or cohorts of different sizes, where higher is better.
This calculator takes 2 inputs: Lines covered by tests, Total lines. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.