Skip to content

Software quality metrics that actually tell you something

B2Bnetwork team · · 6 min

Testing and quality

In brief

A quality metric makes sense when it helps you make a decision: whether to release a version, where to add tests, whether the process is improving. The most informative are defects escaping to production, DORA delivery metrics such as change failure rate and time to restore service, coverage of risks and requirements by tests, and the stability of the automated suite. The number of test cases and code coverage alone say little. Any metric that becomes a target to hit starts to distort.

Why measure quality

Quality metrics answer three questions asked by the business and the team:

  1. Can we release? You need information on the state of a specific version: open defects by severity, risk coverage, the regression result.
  2. Where is the problem? You need information on distribution: which modules have the most defects, where tests are flaky, where the defects that surface latest originate.
  3. Is it better than a quarter ago? You need trends: the number of production defects, time to fix, change failure rate.

A metric that answers none of these questions is just a number in a report. Before adding any metric, write down what decision it is meant to support and who will make it.

Metrics worth measuring

MetricWhat it tells youWhat to watch out for
Defects escaping to productionHow many defects surfaced only with users, by severity and areaYou must count with the same severity definition, otherwise the trend means nothing
Share of defects found before releaseWhat portion of all defects was caught by testingRequires collecting production defects for a longer time after release
Risk and requirements coverageWhich high-risk areas and which requirements have tests and a resultRequires a current risk map and requirements traceability
Stability of the automated suiteThe share of failures unrelated to a code defectRequires labeling the cause of every failure
Time to fix a defectHow long from report to a fix in productionThe mean hides long tails, median and percentile are better
Mutation testing scoreWhether tests detect deliberately introduced code changesComputationally expensive, best on selected modules

The first metric is the most important because it measures what the customer sees. In a banking system, an interest calculation defect reported by a customer after release carries a different weight than ten minor cosmetic defects found in testing, so the data must be split by severity and area, not summed.

DORA delivery metrics

The DORA research program describes software delivery performance metrics in two groups. According to the current guide on dora.dev, they are:

  • throughput: the lead time for changes from commit in version control to running in production, deployment frequency and the time to restore service after a failed deployment;
  • instability: the share of deployments that require immediate intervention, for example a rollback or a hotfix, and the share of unplanned deployments triggered by a production incident.

These metrics combine quality with pace. A team that deploys once a quarter with a full manual regression may have few failed deployments but a long time to restore service, because every fix waits in a queue. A team that deploys often in small changes usually has a shorter path to a fix. DORA metrics are directly tied to testing: the change failure rate tells you how much regression let through, and lead time shows how much time testing takes in the pipeline.

Code coverage and mutation testing

Code coverage tells you which statements or branches were executed during tests. The ISTQB Foundation Level syllabus covers statement and branch coverage as measures for white-box techniques. It is a useful tool for finding places without tests, but a weak measure of test quality, because it does not check whether a test verifies anything. A test without assertions that calls the commission calculation method raises coverage just as much as a test that checks twenty amount variants.

Better information comes from mutation testing. A tool introduces small changes into the code, for example swapping `>` for `>=` or removing a call, and runs the tests. If the tests still pass, the mutation “survived”, which means no test checks that behavior. Tools of this type include PIT for Java and Stryker for JavaScript, C# and Scala. Mutation testing is computationally expensive, so it is best run on modules with the most important logic: fee calculation, scoring rules, transfer validation.

A reasonable use of coverage is a threshold for new code and watching the trend, not a single target for the whole system. A coverage drop in a change is a signal for a conversation in code review, not an automatic block.

Metrics that do harm

A few numbers regularly appear in reports and lead to bad decisions:

  • number of test cases. More cases does not mean better tests. Rewarding the count leads to splitting one test into ten;
  • number of defects found per tester. It encourages reporting trivia separately and discourages cooperation with developers, which prevents defects before they are created;
  • percentage of executed cases without risk context. “95% executed” says nothing if the missing 5% is payments;
  • code coverage as a bonus target. It produces tests without assertions and tests of code that does nothing.

There is one common cause: a metric people are evaluated on stops measuring what it was meant to measure, because people optimize the number, not the quality. That is why quality metrics serve the team's decisions, not the evaluation of employees.

A test report is best when it combines several metrics with a risk map. The stability of the automated suite needs separate attention, because flaky tests distort all the other numbers. On the production side, quality metrics connect to availability and response time targets, which we cover in the article on SLOs and error budgets. What such reporting looks like in a large program is shown by the case study Test management in a claims system replacement program.

Questions and answers

What level of code coverage is sufficient?

There is no single number that fits every system. More important than the overall percentage is whether high-risk logic is covered and whether tests have meaningful assertions. A practical setup is a threshold for new and changed code, mutation testing for key modules and a review of places without tests at every major change. A high percentage with weak assertions gives a false sense of security.

How do you measure defects escaping to production?

Every defect reported after release is labeled with the version in which it originated, its severity and the area of the system. Once per release or once a month, the team counts how many defects from a given version surfaced in production and compares that with the number found in testing. What matters is one written severity definition and an observation period after release, for example a few weeks, so that comparisons are fair.

Do DORA metrics concern testers?

Yes, because testing directly affects at least two of them. The change failure rate shows the effectiveness of regression and pre-release testing. Lead time for changes includes the time of tests in the pipeline and waiting for manual tests. A testing team that shortens regression through automation and selects tests by risk improves both indicators at once.

How many metrics should a quality report contain?

A few, not dozens. A pre-release report needs the state of open defects by severity, risk coverage and the regression result. A quarterly report needs trends: production defects, DORA metrics and automation stability. Every additional number should be justified by a decision it supports. The remaining data can be available in a tool, but not in the report for the management board.

What it looks like in a project

Planning testing for your project? Talk to a test manager.

Let's talk

Read more: Testing and quality