Defect Metrics

Defect metrics are numbers calculated from the defect records in your tracker: how many defects were found, where, how severe they were, how long they stayed open, how many came back after a fix and how many escaped to users. The ISTQB Foundation syllabus lists defect metrics, such as the number of defects found and fixed, defect density and defect detection percentage, among the metrics used to monitor testing.

A simple example: testers found 48 defects before a release, and users reported 12 more in the first 30 days. The defect detection percentage is 48 ÷ 60 = 80%: testing caught four of every five defects known a month later, and 20% escaped.

Why it matters

A tracker with hundreds of defects tells nobody anything until it is summarised. A few well-defined numbers answer the questions a team has to decide on: is the release ready, which component needs more testing or a redesign, are fixes done properly, and is testing finding the important defects before users do?

For a tester they matter twice. You produce the raw data, because every report, severity and status change feeds these numbers, and careless records give wrong metrics. And you are often asked to explain them: "the escape rate rose because the new SMS provider was tested only against its sandbox" helps a team far more than "20%".

The core defect metrics and their formulas

Each metric is a ratio, a time span or a count over fields you already record: creation and closure dates, severity, component, status history, and where the defect was found (a test level or production). Count valid defects only: leave out duplicates and reports rejected as "not a defect".

  • Defect density = defects ÷ size of the work product, such as thousand lines of code (KLOC), function points or stories. It compares areas of different size: 20 defects in a small module can be worse than 30 in a large one.
  • Defect detection percentage (DDP) = defects found by testing ÷ (found by testing + found afterwards) × 100, with an agreed window for "afterwards", such as 30 days in production. The ISTQB glossary defines it per test level, so it also works for system testing alone.
  • Escape rate = defects found afterwards ÷ the same total; it is the complement of DDP. Some teams call it defect leakage, and some divide by the defects found in testing instead of the total, so check the formula before you compare.
  • Defect age = time from report to closure, or to today for an open defect. Report the median (the middle value of the sorted ages) and the oldest defect per severity, not only the average.
  • Reopen rate = defects reopened ÷ defects resolved in the same period. A defect is reopened when confirmation testing shows the fix did not work, or when the failure comes back.
  • Distribution = the split of defects by one attribute: severity, component, where found or root cause. It shows where to act; a single total never does.

Try it: Percentage Calculator Try it: Date Difference Calculator

Worked example: one release of a clinic booking app

Thirty days after release 3.4 of a clinic appointment-booking app went live, the QA lead prepares the retrospective. Of 55 reports from testing, 4 were duplicates and 3 were rejected as "works as designed", leaving 48 valid defects; users and support reported 12 more. The block below holds the cleaned data and the results; this is how the lead reads them.

  • DDP is 80%, which looks acceptable, but one escape is Critical: two patients could book the same slot (fixed in a hotfix). The useful question is why system testing missed concurrent bookings, not whether 80% is good.
  • Booking has the most defects (27), but Notifications, new code for SMS reminders, has almost twice its density: 8.4 against 4.5 per KLOC. It deserves extra attention in the next release.
  • The reopen rate is 12%, and 4 of the 6 reopened defects are in Payments, a sign that fixes there are confirmed on one path only; the team adds refunds to its confirmation tests.
  • 17 of the 60 defects trace back to requirements: an argument for earlier requirement reviews, not for more test cases.
  • Ten defects are still open, none of them Blocker or Critical. Mean age 16.6 days, median 4.5: most are new, and two old ones pull the mean up. What matters is a Major open for 60 days, waiting for the SMS provider, and a Trivial open for 75 days that should be fixed or deliberately deferred.
Ten defects still open after release 3.4, by severity and age: seven are under a week old (median 4.5 days), but one Major has waited 60 days and one Trivial 75 days.
  • 0–7 days
  • 8–30 days
  • over 30 days
  • Major3 open · oldest 60 days
    • 2 0–7 days
    • 0 8–30 days
    • 1 over 30 days
  • Minor5 open · oldest 8 days
    • 4 0–7 days
    • 1 8–30 days
    • 0 over 30 days
  • Trivial2 open · oldest 75 days
    • 1 0–7 days
    • 0 8–30 days
    • 1 over 30 days
  • All open defects10 open · median 4.5 days
    • 7 0–7 days
    • 1 8–30 days
    • 2 over 30 days

Age = days since the defect was reported. No Blocker or Critical defect is open. The mean, 16.6 days, is pulled up by the two old defects but does not name them.

Release 3.4, clinic booking app: tracker export 30 days after go-live

Found before release   55 reports - 4 duplicates - 3 rejected = 48 defects
Found in production    first 30 days                         = 12 defects
                       (1 Critical, 3 Major, 8 Minor)

DDP           48 / (48 + 12)            = 80%
Escape rate   12 / 60                   = 20%
Reopen rate   6 reopened / 50 resolved  = 12%   (4 of the 6 in Payments)

Component       Defects   Changed KLOC   Density
Booking              27            6.0   4.5 per KLOC
Payments             12            3.0   4.0 per KLOC
Notifications        21            2.5   8.4 per KLOC

Root cause (60)     requirements 17 | code 31 | environment 8 | data 4

Open defects (10)   Major 3 | Minor 5 | Trivial 2   (no Blocker or Critical)
Age in days         Major 1, 4, 60 | Minor 2, 2, 3, 6, 8 | Trivial 5, 75
                    mean 16.6 | median 4.5

Reading defect metrics carefully

Before you compare two numbers, check that they were counted the same way, and ask what else could explain them.

  • Fixed rules: the same definition of a valid defect, the same severity scale and classification (IEEE 1044 is a standard scheme for classifying software anomalies) and the same window. An escape rate measured after 7 days cannot be compared with one measured after 90.
  • Counts next to percentages: small numbers swing hard. 2 escapes out of 10 is 20%; one more makes it 3 of 11, or 27%.
  • Trends, not snapshots: compare a component or a team with its own previous releases, not with another product.
  • Context: a low count can mean good code or little testing; a high density can mean weak code or thorough testing. As the first testing principle says, testing shows the presence of defects, not their absence.
  • Pairs: read DDP with the severity of what escaped, defect age with severity, and density with how much testing that area received.

How defect metrics are misused

Defect metrics describe a product and a process. They go wrong when they become targets for people: once a number decides praise or blame, people manage the number instead of the quality, an effect usually called Goodhart’s law.

  • Bugs per tester as a performance score: one problem is split into several reports, hard investigations are avoided, and testers compete instead of helping developers.
  • Defects per developer: every report becomes an argument, and problems are fixed quietly in chat without a record.
  • A target such as "defect age under 10 days": defects are closed as "cannot reproduce" or deferred without agreement, and the age improves while users wait.
  • A target on escape or reopen rate: production defects are relabelled as change requests, and reopened defects are filed as new ones.
  • League tables across teams: different products, risks and reporting habits make the comparison meaningless, and teams learn to report less.

Common mistakes

  • Counting duplicates and rejected reports, so the total grows with the noise in the tracker.
  • Reporting a percentage without its counts and window: "escape rate 20%" of how many defects, measured over which period?
  • Reporting only the mean defect age, so the oldest Major or Critical defect stays hidden.
  • Treating a low defect count as proof of quality without asking how much was tested.
  • Comparing defect density between teams or products that measure size and severity differently.

The QA perspective

On a real team your first contribution is clean data: the right severity and component, where the defect was found, duplicates linked and closed, and a root cause recorded once the fix is known. Agree these fields and the counting rules with the QA lead at the start of a release.

When you present metrics in triage, a release review or a retrospective, bring the counts, the trend and one sentence of interpretation, and end with a proposal: "Four of six reopened defects are in Payments; can we add refunds to the confirmation tests?" Ask which decision each number supports, and never use the numbers to rank individuals.

Practice exercise

Calculate and read the defect metrics of a sprint

Your task

An online shop released a two-week sprint 14 days ago. The export below is cleaned: no duplicates or rejected reports. "production" means reported by users after the release; Age is days from report to closure, or to today if the defect is still open.

Calculate the metrics, then write a three-sentence summary for the retrospective.

Material
Changed in the sprint (KLOC): Checkout 1.5 | Search 2.0 | Profile 1.0

ID     Severity  Component  Found in    Status  Age  Reopened  Root cause
SP-01  Major     Search     testing     Closed    3  no        code
SP-02  Minor     Search     testing     Closed    2  yes       code
SP-03  Critical  Checkout   testing     Closed    1  no        requirements
SP-04  Major     Checkout   testing     Closed    5  yes       requirements
SP-05  Minor     Profile    testing     Closed    2  no        code
SP-06  Minor     Checkout   testing     Open      4  no        requirements
SP-07  Trivial   Profile    testing     Open     26  no        code
SP-08  Major     Checkout   testing     Closed    6  yes       code
SP-09  Minor     Search     testing     Open      9  no        environment
SP-10  Major     Checkout   production  Open      3  no        requirements
SP-11  Minor     Profile    production  Closed    2  no        code
SP-12  Major     Checkout   production  Open     12  no        requirements
Steps
  1. Calculate the DDP and the escape rate.
  2. Calculate the reopen rate of the closed defects.
  3. Calculate the mean and median age of the open defects, and name the oldest open defect of each severity.
  4. Calculate the density per component, and look at the distribution by root cause.
  5. Write the summary with counts next to every percentage and one proposal.
Show the model answer
Model answer

DDP = 9 ÷ 12 = 75% (9 found in testing, 3 in production); escape rate = 3 ÷ 12 = 25%. Two of the three escapes are Major, both in Checkout.

Reopen rate = 3 ÷ 7 ≈ 43%: SP-02, SP-04 and SP-08 of the 7 closed defects, two of them in Checkout.

Open ages: 3, 4, 9, 12 and 26 days. Mean = 54 ÷ 5 = 10.8 days, median = 9. Oldest per severity: Major SP-12 (12 days, from production), Minor SP-09 (9), Trivial SP-07 (26).

Density per KLOC: Checkout 6 ÷ 1.5 = 4.0, Search 3 ÷ 2.0 = 1.5, Profile 3 ÷ 1.0 = 3.0. Root causes: requirements 5, code 6, environment 1, and all 5 requirement defects are in Checkout.

Summary: "Testing found 9 of 12 known defects (DDP 75%); both Major escapes are in Checkout and trace to requirements. Checkout also has the highest density (4.0 per KLOC), all 5 requirement defects and 2 of the 3 reopens, so we propose reviewing its acceptance criteria with the product owner before the next sprint. SP-12, a production Major open for 12 days, needs an owner today." With 12 defects, each one moves a percentage by about 8 points, so state the counts.

Frequently asked questions

What is a good defect detection percentage?

There is no universal target: it depends on the product, the window and the counting rules. Compare your own releases over time and look at the severity of what escaped; a stable DDP with no Critical escapes says more than a number borrowed from elsewhere.

Why report the median defect age instead of the average?

Defect ages are skewed: most defects close within days, a few stay open for weeks. The mean follows those few, the median shows the typical defect. Report the median together with the oldest open defect per severity.

Should defect metrics be used to evaluate testers or developers?

No. Counts per person are easy to game and discourage the collaboration and prevention work that reduce defects. Use defect metrics at team or component level to ask better questions, and discuss individual work in conversation.

Where does the data for defect metrics come from?

From the defect tracker: creation and closure dates, status history, severity, component, where found and root cause. Production defects from support tickets or incidents must be logged in the same tracker, or linked to it, so they are counted with the same rules.

References

Practise with Mutqan tools

Calculate percentages, percentage change, increase/decrease and what percent X is of Y.

Utilities

Calculate the exact difference between two dates in years, months, days, hours and total units.

Utilities

Go deeper

Your progress on this topic

Part of the QA Roadmap