Test Coverage Calculator
Measure test coverage as the share of lines or branches exercised by tests.
About Test Coverage Calculator
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.
Formula
Test Coverage
Test Coverage = Lines covered by tests ÷ Total lines × 100
- Lines covered by tests
- The subset being measured
- Total lines
- The full population it is drawn from
Worked example
With the default values below, Test Coverage Calculator returns Test Coverage of 84.00%. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Lines covered by testsminimum 0
- 8,400
- Total linesminimum 0
- 10,000
Results
- Test Coverage
- 84.00%
- Remaining (whole minus part)
- 1,600
- Equivalent per 1,000
- 840.0
- One in Every
- 1.2
Step by step
- 1Values used
- 2Test Coverage
- 3Test Coverage= 84.00
- 4Remaining (whole minus part)= 1,600
- 5Equivalent per 1,000= 840.0
- 6One in Every= 1.2
Assumptions and limits
- The result is derived only from the 2 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 2 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
How is Test Coverage calculated?
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.
Why does Test Coverage matter?
Absolute counts hide scale — a rate normalises the number so you can compare periods, channels or cohorts of different sizes, where higher is better.
What values do I need to enter?
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.
