KPI Tree

Metric Definition

Test quality metric

Code Coverage Trend = (Coverage in Current Period - Coverage in Prior Period) / Coverage in Prior Period
Coverage in Current PeriodThe percentage of code lines or branches executed by the test suite in the latest measurement period
Coverage in Prior PeriodThe same coverage percentage measured in the previous period, used as the baseline for comparison

Track from

Metric GlossaryOperations Metrics

Code coverage trend

Code coverage trend is the direction and rate at which the percentage of code exercised by automated tests changes over successive releases. A single coverage figure is a snapshot, while the trend shows whether the test suite is keeping pace with the codebase or falling behind. It tells an engineering team whether quality discipline is improving, holding, or quietly eroding.

7 min read

Generate AI summary

What is code coverage trend?

Code coverage trend is the direction and rate at which test coverage changes from one period to the next. Coverage itself is the share of code executed when the test suite runs, usually expressed as a percentage of lines or branches. If a codebase sat at 72 percent coverage last month and 68 percent this month, the trend is negative: roughly 4 points lost, or about 6 percent of the prior figure. The trend is what turns a static number into a signal about whether testing discipline is being maintained.

The trend matters more than the absolute figure because absolute coverage is easy to misread. A team at 90 percent coverage that is sliding downward is in a worse position than a team at 70 percent that is steadily climbing. The first is accumulating untested code faster than it tests it. The second is closing the gap. The direction reveals the underlying engineering behaviour, while the snapshot only describes the current state.

Coverage trend usually moves for one of two reasons. Either new code is being added without tests, which dilutes coverage because the denominator grows faster than the tested numerator, or existing tests are being removed or disabled faster than they are replaced. Reading the trend alongside how much code changed in the period separates these causes. A sharp drop during a large feature release points to untested new code, while a drop in a quiet period points to tests being deleted or skipped.

A rising coverage trend is not automatically good and a falling one is not automatically bad. Coverage measures whether code runs during tests, not whether the tests assert anything meaningful. Read the trend together with defect rates so you can tell genuine quality improvement from tests written only to lift the number.

How to calculate code coverage trend

To calculate the trend, measure coverage consistently each period using the same tool and the same definition, then compare the latest figure against the prior one as a percentage change. The consistency matters more than the precise method. If one period counts line coverage and the next counts branch coverage, the comparison is meaningless. Pick one definition and hold it steady.

For example, a service measured at 75 percent coverage in the previous sprint and 78 percent in the current sprint has a trend of 3 points, or 4 percent of the prior figure, an improvement. Plotting these figures across many periods gives the trend line, which is more informative than any single comparison because it smooths out the noise of individual releases and shows the underlying direction.

  1. 1

    Fix the coverage definition

    Decide whether you are measuring line coverage, branch coverage, or function coverage, and use the same definition every period. Branch coverage is stricter and usually more meaningful, but the key is consistency over time.

  2. 2

    Exclude generated and vendored code

    Generated code, third-party libraries, and test files themselves should sit outside the measurement. Including them distorts both the figure and the trend, usually by inflating it artificially.

  3. 3

    Measure on a fixed cadence

    Capture coverage on every build or at a regular interval such as each sprint. A trend needs a steady stream of comparable points, so automate the capture rather than measuring ad hoc.

  4. 4

    Compare against the prior period

    Express the change as both an absolute point difference and a percentage of the prior figure. Plot the points over time so the underlying direction is visible rather than relying on a single noisy comparison.

Code coverage trend in a metric tree

A coverage trend is the net result of forces pulling in opposite directions: code being added, tests being written, and tests being lost. A metric tree separates these so a falling trend can be traced to its source rather than guessed at. When coverage drops, the tree shows whether new untested code caused it or whether the existing suite is decaying.

Metric tree insight

A coverage trend that is falling because of a one-off large feature release is a different problem from one falling because tests are quietly being skipped. The first self-corrects once tests catch up, the second compounds. KPI Tree models each branch as a node with its own trend and a RACI owner, so the new-code branch sits with the team shipping features and the suite-decay branch sits with whoever owns test health. The accountable owner is pushed the moment their branch turns negative, before the headline number raises an alarm.

Code coverage trend benchmarks

Benchmarks for coverage trend describe direction and stability rather than a target percentage. The widely repeated 80 percent coverage figure is a rough convention, not a law, and chasing it can produce shallow tests that lift the number without catching defects. What matters for a trend is that it is stable or gently rising, and that it does not whipsaw release to release. The ranges below frame what healthy trend behaviour looks like.

Trend patternTypical readingWhat it indicates
Stable, gently risingPlus 0 to 2 points per periodNew code is being tested at roughly the rate it is added. The healthiest pattern for a mature codebase.
Flat at a high levelSteady around 75 to 85 percentCoverage is mature and maintained. Effort should shift from raising the number to improving the quality of the tests behind it.
Slow declineMinus 1 to 3 points per periodNew code is outpacing test writing. Easy to miss because each step is small, but it compounds into a real gap over a quarter.
Sharp dropMinus 5 points or more in one periodA large untested feature landed or tests were removed. Worth an immediate look to find which branch of the tree caused it.

Compare a coverage trend against the team own history rather than an industry figure. A codebase that has held steady at 70 percent for a year with a low defect rate is in better shape than one oscillating between 60 and 85 percent, because the stable one reflects a consistent testing habit. Volatility in the trend usually signals an inconsistent practice, not a coverage problem.

How to improve code coverage trend

Improving a coverage trend is less about a coverage sprint that lifts the number once and more about changing the habits that move it every release. The aim is a steady upward or stable trend driven by tested new code, not a one-off spike that decays the moment attention moves elsewhere.

Gate coverage on new code

Require that changed lines in each pull request meet a coverage threshold, rather than gating the whole codebase. This stops new untested code from diluting the trend without forcing a backfill of legacy code all at once.

Review tests, not just code

Make test quality an explicit part of code review. A reviewer who checks that tests assert real behaviour, not just execute lines, keeps coverage meaningful as it rises rather than hollow.

Prioritise critical paths

Direct coverage effort at the code that handles money, authentication, and core business logic first. Coverage on the riskiest paths protects the trend where a failure would cost the most.

Track the trend, not the snapshot

Publish the trend line, not just the latest percentage. Seeing the direction every release keeps the team focused on maintaining the habit rather than hitting a one-time number and relaxing.

Common mistakes when tracking code coverage trend

  1. 1

    Chasing the percentage instead of the direction

    Fixating on hitting 80 percent invites shallow tests that execute code without asserting anything. The trend stays honest only if the tests behind it remain meaningful.

  2. 2

    Changing the coverage definition mid-stream

    Switching from line to branch coverage, or excluding different files between periods, breaks the comparison. The trend line becomes a measure of how you measured, not of the code.

  3. 3

    Ignoring why coverage dropped

    A falling trend has very different causes. Reacting to the number without checking whether new code or test deletion caused it leads to the wrong fix.

  4. 4

    Treating coverage as proof of quality

    High coverage with weak assertions catches few real defects. A rising trend should be read alongside defect and escape rates, never on its own.

Related metrics

Deployment frequency

DORA metric

Operations Metrics
GitHub

Metric Definition

Deployment Frequency = Number of Production Deployments / Time Period

Deployment frequency measures how often an organisation successfully releases code to production. It is one of the four DORA (DevOps Research and Assessment) metrics that predict software delivery performance and organisational outcomes. Teams that deploy more frequently deliver value to users faster, reduce the risk of each individual release, and create tighter feedback loops between development and production.

View metric

Cycle time

Process speed

Operations Metrics
Jira

Metric Definition

Cycle Time = Process End Time − Process Start Time

Cycle time measures the total elapsed time from the start to the end of a process. It is a fundamental operations metric used in manufacturing, software development, service delivery, and any context where the speed of a process directly affects throughput, cost, and customer satisfaction.

View metric

Sprint velocity

Agile planning metric

Operations Metrics
Jira

Metric Definition

Sprint Velocity = Sum of Story Points Completed in a Sprint

Sprint velocity measures the amount of work a team completes during a sprint, typically expressed in story points, ideal days, or another unit of estimation. It is a planning tool that helps agile teams forecast how much work they can commit to in future sprints based on their historical completion rate. Velocity is one of the most widely used and most frequently misunderstood metrics in agile software development.

View metric

Metric trees for engineering teams

Metric Definition

Code coverage trend sits alongside the other engineering quality signals you can map into a metric tree to give your team a shared view of test health.

View metric

Why did my metric change?

Metric Definition

When code coverage trend moves, this diagnostic framework helps you trace whether new untested code, deleted tests or shifting scope is driving the change.

View metric

Build code coverage trend as a metric tree in KPI Tree

Model your coverage trend as a tree, separating new-code testing, suite decay, and test effectiveness onto distinct branches with a RACI owner on each. When a branch turns negative, KPI Tree pushes it to the accountable owner so erosion is caught and addressed before the headline figure raises an alarm.

Experience That Matters

Built by a team that's been in your shoes

Our team brings deep experience from leading Data, Growth and People teams at some of the fastest growing scaleups in Europe through to IPO and beyond. We've faced the same challenges you're facing now.

Checkout.com
Planet
UK Government
Travelex
BT
Sainsbury's
Goldman Sachs
Dojo
Redpin
Farfetch
Just Eat for Business