QA Interview Hub · Knowledge base · Quizzes · Українська

QA Fundamentals

Quality metrics

what to measure, how to count, what to avoid

How do you choose quality metrics for a project?

Quality metrics are chosen from a goal, not from a popular list: under GQM the goal comes first, then the questions, and only then the metrics. Each metric has an owner, a threshold and an action when it is crossed, otherwise it is decoration. Values are read as a trend against the team's baseline, and lagging metrics (leakage) are combined with leading ones (waiting time in QA).

QA Fundamentals · Quality metrics

A dashboard shows twenty metrics and none says what to do. Where should the choice start?

A QA lead shows a manager a dashboard: one hundred forty-three open bugs, eighteen hundred test cases, code coverage 71%. The manager nods and asks: "And what of this is bad?". There is no answer: the numbers exist, but nobody agreed what counts as normal or what to do when they change. This lesson is about choosing metrics so that each answers a concrete question and triggers an action, and why you start from a goal and not from a list of "popular" metrics.

How it works and why. The GQM framework (Goal → Question → Metric) from software engineering (Basili) sets the order: first the goal, then the questions you must answer to know whether the goal is reached, and only then the metrics that answer those questions. The order matters for two reasons. A metric without a question has no interpretation: are "143 open bugs" many or few? It depends on what we want to know. And a metric without a goal easily survives when nobody needs it any more: it is collected because "Jira can do it".

From goal to metric: three steps

GoalFewer defects reachusers QuestionHow many bugs do we miss?Where: which module, which stage? MetricDefect leakage in 30 daysProd bugs by module and stage
Figure 1. GQM reads top to bottom. If a metric cannot be traced up to a goal, it is redundant.

In a good set three more things are attached to a metric: an owner (who looks at it and answers for it), a threshold or expectation (what counts as normal) and an action (what we do when the threshold is crossed). Without an action a metric is decoration: people look at it, sigh and move on.

Example: from a list to GQM. The team's initial dashboard:

QA dashboard (everything Jira can count):
  open bugs                      — 143
  test cases                     — 1,870
  tests executed per day         — 212
  average bug age                — 41 days
  bugs per tester                — 18 / 11 / 7
  code coverage                  — 71%

Every number is true, but none answers a question. "Bugs per tester" is also harmful: it encourages splitting bugs (a separate lesson covers this). Rebuilt from the goal it looks like this:

Goal:      fewer defects reach users
Question:  how many bugs do we let into production?
Metric:    defect leakage in 30 days after release (Major+ only)
Owner:     QA lead
Action:    leakage > 10% twice in a row → analyse every escaped
           bug: at which stage should it have been caught

Question:  where exactly do we miss them?
Metric:    prod bugs by module and by "stage where it could be found"
Owner:     QA lead with the dev team lead
Action:    a module with 3+ bugs per quarter → more API-level
           tests and a review checklist

Now the dashboard has two metrics instead of six, and each has an owner and an action. The action fires when a threshold is crossed, not at "let's look next month". The other numbers did not disappear: they live in the tracker and are needed when you must understand why a metric is bad. But what reaches the dashboard is what answers the questions of the goal.

Limits and alternatives. GQM gives an order of reasoning but does not suggest thresholds: they must come from the team's history (the baseline) or from an agreement with stakeholders, not from internet articles about a "normal" percentage. Metrics are lagging (leakage is known only weeks after a release) or leading (waiting time in "Ready for QA" is visible today): it helps to have both, because the first says whether we reached the goal and the second whether we can still change something. Product quality metrics (defects, failures) are not the same as process metrics (fix time, reopen) and project metrics (progress, budget): ISTQB CTFL splits test metrics even finer (project and test progress, product quality, defects, risks, coverage, cost), and one question often needs metrics from several groups. Other approaches (OKR, DORA, SPACE) are other frames of the same idea: numbers exist for decisions. Measuring also costs: if data is collected by hand and brings no value, the metric should be removed.

Common mistakes.

  • Taking metrics from a template or a previous project: they answer someone else's questions and move no decision on yours.
  • Collecting everything the tracker can count: twenty numbers hide the one that matters, and maintaining the dashboard eats time.
  • A metric with no threshold and no action: the first red value triggers nothing, and trust in the dashboard falls.
  • Looking at one value instead of a trend: "leakage 12%" says little, while "it was 18%, now 12%, and the team added API tests" is already a story.
  • Changing the way of counting without a warning: the trend breaks and the comparison with the previous quarter becomes false.

Check yourself

A manager asks to "add the automation coverage metric to the dashboard". Which question do you ask first and why?

Answer

Which decision should this number help make: automate more, drop manual regression, or show progress? Without a goal "coverage" can be pushed to 90% with trivial tests and bring nothing. The question about the goal decides which version of the metric is needed: the share of critical scenarios, the share of regression or the regression time.

You have a leakage metric and a rule: a value above 10% → analysis of the escaped bugs. It was 8%, 9%, 14%. What do you do and what do you not do yet?

Answer

The action attached to the threshold: I analyse the escaped bugs of the last release and look for a common cause (module, stage, type of requirement). I do not conclude from one value that quality "got worse" and I do not blame anyone for the number: I check whether something changed in the release (scope, mix of changes) and whether the next release confirms the trend.

In an interview. Junior: I start from a goal, not from a metric: for example, fewer defects in production. Then I phrase the questions (how many we miss, where) and only then pick metrics such as defect leakage. I keep three to five key metrics, and each has an owner and an action. Middle/Senior: I use GQM and attach an owner, an expectation and an action to every metric, otherwise it is decoration. I look at the trend against the team’s own baseline, not at other people’s "normal" percentages, and I combine lagging metrics (leakage) with leading ones (waiting time for QA). A metric nobody reacts to, I remove.

What are defect leakage, DRE and defect density and how do you calculate them?

Defect leakage is the share of defects missed into production out of all found: production bugs ÷ (pre-release bugs + production bugs). DRE is the complementary share, caught before release, that is 100% minus leakage. Defect density is defects per unit of size (for example KLOC), used to compare modules. Leakage is final only after a fixed observation window, and the formula and which defects count are decided in advance.

QA Fundamentals · Quality metrics

A release had 45 bugs found and 5 more from production. Is that good, and how do you calculate it?

After a release five complaints reach support and turn out to be defects. The team asks: is this a normal result of testing or did we miss something? "Seems fine" is not an answer, because next quarter there is nothing to compare the five bugs with. Three metrics give a language for this conversation: defect leakage (how many we missed), DRE (how many we caught) and defect density (where defects concentrate). The lesson shows how to calculate them and why the same numbers can be read wrongly.

How it works and why. All three metrics rest on one thing: each defect has a known place where it was found (before release or in production) and a link to a context (release, module). So the first thing to set up in the tracker is a "found in production" mark (a label, a field or an environment type) and a link from a bug to a release or module. Without it the metrics must be counted by hand, which means rarely and with errors.

MetricFormulaThe question it answers
Defect leakageprod bugs ÷ (bugs before release + prod bugs) × 100%What share of defects did we miss?
DRE (Defect Removal Efficiency)bugs before release ÷ (bugs before release + prod bugs) × 100%What share of defects did we catch? It is 100% minus leakage
Defect densitynumber of defects ÷ size (KLOC, function points, story points)Where are there more defects than size alone explains?

In ISTQB terms the closest indicator to DRE is the defect detection percentage (DDP): the share of defects found by a given test level out of all found at that level and later. That is the idea of a "phase": DRE can be calculated for each stage separately (code review, unit, integration, system tests, production) to see where defects slip through. Defect density exists to compare the incomparable: a module with twenty bugs can be healthier than a module with six if the first is five times larger.

One release: what we caught and what we did not

All defects of the release: 5045 before release5DRE = 45 / 50 = 90%leakage = 5 / 50 = 10%
Figure 1. Leakage and DRE are two parts of one whole: they always add up to 100%.

Example: the calculation and two ways to misread it. Data of one release with a 30-day window:

Release 2.15, post-release window: 30 days.

                   before release   from prod   total
all defects              45             5          50
Major and above          38             4          42

leakage (all)      = 5 / 50  = 10%      DRE (all)      = 90%
leakage (Major+)   = 4 / 42  ≈ 9.5%     DRE (Major+)   ≈ 90.5%

Defect density by module:
  Payments   12 defects / 8 KLOC   = 1.5 per KLOC
  Profile     9 defects / 1.5 KLOC = 6.0 per KLOC

The first thing visible: counting only Major and above gives almost the same picture (9.5% against 10%), so minor bugs do not distort the conclusion. If there were far more minor ones, the "all defects" metric would show the activity of testers, not quality. That is why the criterion "which defects we count" is fixed in advance and not changed. Second: defect density showed what counts alone do not. "Payments" has more defects (12 against 9), but in Profile the density is four times higher (6.0 against 1.5 per KLOC), and that is where to look. Still, density is a reason to ask a question, not a verdict: Profile could be small and complex while Payments is big but simple.

Limits and alternatives. The leakage of a release is final only when the observation window has ended. Calculated after three days it looks great, because users have not yet had time to find the bugs. So the window (for example, 30 days) is fixed and releases are compared with equal windows. The second nuance: what counts as a "bug from production". A change request that came in as a bug shifts the numbers, so it is filtered out during the analysis. The third: leakage depends on how many defects were introduced. A team that catches everything but received very defective code in a release will have a low leakage and still many defects overall, so these metrics are read together with the number of open ones and with the trend. The fourth: defect density depends on the unit of size, and KLOC is not comparable across languages, so modules of one system are compared, not different projects. Alternatives or additions: escaped defects by severity, the lifetime of a defect in production, DRE by stage.

Common mistakes.

  • Calculating DRE three days after a release: most production defects are not found yet, and the number is too good.
  • Mixing bugs and change requests: leakage grows not because of testing but because of imprecise requirements.
  • Not fixing which defects are counted: one quarter counts everything, the next only Major, and the trend is broken.
  • Comparing the density of modules of different nature without context: a front-end form and a payment core have different complexity.
  • Making leakage a personal target for QA: then production bugs start to be classified as "not ours", and the metric stops working.

Check yourself

A team found 18 defects before a release and 2 in production within a month. A week after the release a developer boasts: "Our leakage is 0%". What is wrong with this statement?

Answer

The observation window has not ended: users are only starting to find defects, so 0% is incomplete data. Only after a fixed window (say, 30 days) can leakage be compared with other releases. For this release, with two production bugs, the final value is 2/20 = 10%, not 0%.

The defect density of module A is 1.2 per KLOC, of module B 5. Does this mean B is tested worse?

Answer

Not necessarily. A high density can mean more defects, better detection, more complex logic or frequent changes. It is a reason to dig: check whether the defects were found by testing or by users, how the module changes, whether its requirements are unclear. A conclusion about the quality of testing is made by the DRE of this module, not by density alone.

In an interview. Junior: Leakage is the share of defects we missed into production out of all found. DRE is the opposite, the share found before release. For example, 45 bugs before release and 5 after give 10% leakage and 90% DRE. Defect density shows which modules are the most problematic relative to size. Middle/Senior: I fix what exactly I count (Major+ only, bugs rather than change requests) and the post-release window (say, 30 days), and I compare only releases with the same rules. I look at DRE by stage to see where defects slip through, and I read density together with the size and the changes of a module. I do not make them a personal target: they are for analysing the process.

How does requirements coverage differ from code coverage? Is 100% needed?

Requirements coverage is the share of requirements that have at least one test; code coverage is the share of code the tests execute. Neither measures the quality of the checks: tests with no asserts can still reach 100% code coverage. So 100% is not a goal: near-100% branch coverage is justified for critical logic, mutation testing shows whether checks react, and the real target is risk coverage.

QA Fundamentals · Quality metrics

Code coverage is 100%, yet there is a bug in production. How, and what coverage is really needed?

The CI report shows a green line: code coverage 100%. A week later a bug is found in production in a function that was "fully covered". The analysis shows the test called the function but checked nothing. This lesson is about two different things called "coverage": requirements coverage and code coverage, what each shows and does not show, and why the right answer to "is 100% needed" depends on risk.

How it works and why. Requirements coverage is the share of requirements or acceptance criteria that have at least one test. It is visible from a traceability matrix (requirement → test) or from links in Jira and Zephyr/Xray. It answers "do we check what was promised at all?". It says nothing about whether the tests passed: that is a separate metric of execution progress.

Code coverage is the share of code that tests execute: statements, decision branches, sometimes functions. It is measured by tools (JaCoCo for Java, Istanbul or c8 for JavaScript, coverage.py for Python), most often during unit and integration tests. It answers "which part of the code do tests touch at all?". The key word is "execute": coverage does not check that a result is correct, only that a line was run. So it reliably shows untested code and unreliably shows that code is tested well. Branch coverage is stricter than statement coverage: a line with a condition can be "covered" even if the false path was never checked.

What each coverage knows and does not know

Requirements

Requirements coverage

Question: is there a test for every promise? Measured with a traceability matrix. Does not see: how deep the tests are, or code that is absent from the requirements.

Code

Code coverage

Question: what do tests execute? Measured by a tool. Does not see: whether the result is verified, or a requirement that is not implemented in the code.

Figure 1. Two axes of measuring: they answer different questions and do not replace each other.

Together they give a diagnostic grid. If at least one axis shows "bad", there is something to discuss; if both show "good", it is still no guarantee, because neither axis measures the quality of assertions.

Requirements and code together

Code executedCode not executedrequirement testedFine if theassertions are realrequirement testedCode with norequirement or checkrequirement untestedCode runs, therequirement is unverifiedrequirement untestedBlind spot:nothing is verified
Figure 2. The highlighted cells are situations where one metric masks a problem the other one sees.

Example: a hundred percent coverage that guarantees nothing. A discount function and a test that "covers" it:

export function discount(total: number, vip: boolean) {
  if (vip && total >= 1000) return total * 0.9;
  return total;
}

// 100% line and branch coverage, nothing is checked
test('discount runs', () => {
  discount(1000, true);
  discount(500, false);
});

The tool will show 100% of lines and both branches, but if someone replaces 0.9 with 0.09 or >= with >, the test stays green. The test ran the code and checked nothing. The fix: tests with expected values at the boundary of the rule:

test('VIP at the 1000 boundary gets 10%', () => {
  expect(discount(1000, true)).toBe(900);
});
test('VIP below the boundary pays in full', () => {
  expect(discount(999.99, true)).toBe(999.99);
});
test('non-VIP gets no discount', () => {
  expect(discount(5000, false)).toBe(5000);
});

Coverage here stays 100%, but now changing >= to > breaks the first test, and changing the factor breaks it too. The quality of checks can be measured by mutation testing (Stryker for JavaScript, PIT for Java): the tool makes small changes in the code (mutants) and checks whether at least one test fails. The share of "killed" mutants shows that tests really react to changes and do not just execute lines. It is more expensive than ordinary coverage, so it is used selectively, on critical logic.

Limits and alternatives. "Is 100% needed" is a wrongly posed question. For critical logic (commission calculation, access rights) branch coverage close to 100% is justified, because the price of a mistake is high. For generated code, configuration and trivial getters, chasing the percentage gives tests nobody will read. Practical rules: a threshold on new changes (for example, coverage of new code in a PR not below a set threshold) is more convenient than a global percentage, because it does not force rewriting the old code base; and the threshold must not be a personal target (see the lesson about harmful metrics). Requirements have their own limit: 100% requirements coverage means only "each has at least one test", and the depth is decided by test design (equivalence classes, boundaries) and risk. So the real orientation is risk coverage: critical scenarios are covered in depth (several levels, positive and negative), secondary ones enough.

Common mistakes.

  • Treating 100% code coverage as a guarantee of quality: tests without assertions produce it.
  • Making the coverage percentage a team target: tests written for the line appear, while real checks are not added.
  • Counting requirements coverage without depth: one positive case per requirement is marked "covered" though negatives and boundaries are missing.
  • Measuring code coverage with unit tests only and drawing conclusions about e2e, or the other way round: different levels cover different things.
  • Ignoring branch coverage and looking at lines only: the false path of a condition stays unchecked.

Check yourself

In a PR the coverage of new lines is 100%, but the tests are just function calls with no expect. Which metric do you add and what will it show?

Answer

Mutation testing for this module (Stryker or PIT), or at least a check that tests contain assertions. It will show surviving mutants: code changes after which all tests stayed green. It is a direct measure of whether checks react to changes and not only execute lines.

A traceability matrix shows that 100% of requirements have tests. Does this mean the product is tested well? What else do you check?

Answer

No. It only means each requirement has at least one test. I check depth (are there negative scenarios and boundaries by test design technique), whether those tests passed, and whether there is code or behaviour that the requirements do not describe. I add risk coverage: are the most critical scenarios checked at several levels.

In an interview. Junior: Requirements coverage shows what share of requirements have tests. Code coverage shows what share of code is executed by tests. A hundred percent is not a goal for me: a test can run a line and check nothing. I look at risk coverage: critical scenarios are covered in depth. Middle/Senior: Code coverage is good at showing untested code but does not prove the quality of checks, so for critical logic I add mutation testing and look at branch coverage. For new code I set a threshold in the PR instead of a global percentage, and I do not turn it into a personal target. I read requirements coverage together with the depth of test design and with risk.

Which process metrics do you track?

Process metrics show where work is delayed and what comes back: fix time, reopen rate, rejected rate and time in status. Test execution progress and the age of open bugs are tracked too. Fix time is reported as a median and a percentile (85th or 90th), not a mean. They are read over several sprints, for a conversation about the process and not to rate people.

QA Fundamentals · Quality metrics

Tasks wait weeks for QA and bugs come back as "not a bug". What should you measure?

A sprint retro: developers say QA "tests for too long", testers say tasks arrive on Friday, and a third of their bugs come back marked "not a bug". Each side is right from where it stands, and without numbers the talk goes in circles. Process metrics show where exactly work is delayed and what comes back. This lesson is about which metrics these are, how to read them and why they exist for a conversation about the process, not about people.

How it works and why. Process metrics measure not the product but the movement of work through the process: how much time is spent at each stage, how much work returns and where a queue builds up. There are few basic metrics, and almost all come from the history of statuses in the tracker.

MetricHow it is calculatedWhat it signals
Fix time by severitymedian (and the 85th or 90th percentile) from Open to Done, separately for Critical, Major, MinorWhether we meet agreed terms; whether critical bugs really get fixed faster
Reopen ratereopened bugs ÷ closed in the periodThe quality of fixes or retest, incomplete reproduction steps
Rejected raterejected ("not a bug", duplicate, cannot reproduce) ÷ filedThe quality of reports, unclear requirements, no search for duplicates
Test execution progressexecuted / passed / failed / blocked against the plan at this pointWhether we make it to the release, where the blockers are
Time in status (Ready for QA, In QA)median time a task spends in a statusBottlenecks and queues
Age of open bugshow many days a bug has been open without movementThe "tail" of old bugs nobody fixes

Why the median and a percentile, not the average: fix time is distributed unevenly, one bug that hung for half a year raises the average and says nothing about the typical case. The median shows the typical task, and the 85th or 90th percentile shows how bad it can get, and that is the one convenient to promise in an agreement ("90% of Major are fixed within 5 days"). In ISTQB terms test execution progress belongs to the test progress metrics: what a progress report (see the lesson about the test report) usually shows as "executed X of Y, passed, failed, blocked".

Where a bug spends its time

In development2 daysReady for QA (queue)4 daysIn testing1 dayWaiting for release2 days
Figure 1. Of the nine days of a bug’s life, four it simply waits in the queue for QA: the bottleneck is not in testing itself.

Example: how to read the numbers of one sprint.

Sprint 23 (example data from the tracker)

Bugs closed: 40, of them reopened: 6
  → reopen rate = 6 / 40 = 15% (4 of 6 in the "Payments" module)

Bugs filed: 30, rejected: 9
  (3 duplicates, 4 "not a bug", 2 "cannot reproduce")
  → rejected rate = 9 / 30 = 30%

Time from Open to Done, median:
  Critical 1 day, Major 4 days, Minor 11 days

Time in "Ready for QA": median 2.5 days, longest 6 days

Each number suggests a hypothesis, not a verdict. Reopen rate 15%, 4 of 6 in "Payments": it looks like the module is fixed without enough unit tests, or the retest does not repeat the full steps. We check the reasons for reopening (not fixed, partly fixed, regression) and do not scold the developer. Rejected rate 30%, of which 4 are "not a bug": a difference in understanding the requirements, so it is a question to the PO and to our reports, whether we referred to a requirement. The two "cannot reproduce" remind us of steps and environment. Duplicates (3) point to nobody searching before filing. Fix time Critical 1 day against Minor 11 days: a normal picture, critical ones really are faster. Ready for QA with a median of 2.5 days and a peak of 6: it is the queue before testing, not the speed of testers, that slows tasks, and it must be solved at the process level (a WIP limit, testing during development, smaller tasks), not with a reminder "test faster".

Limits and alternatives. Process metrics make sense only when the team understands statuses the same way: if some set "Done" after the merge and others after the release, the time between stages is not comparable. Small samples deceive: on five bugs "reopen rate 40%" says nothing, so such metrics are read over several sprints or per quarter. Metrics also depend on culture: where reopening is criticised, bugs stop being reopened and new tickets are created instead, and the number looks better though the process did not improve. Another group often named in this context is cycle time and lead time from Kanban: the time to completion from the start of work (cycle time) or from the appearance of a request (lead time); they cover the whole flow, not only QA. To show how a queue changes, a cumulative flow diagram is used: a widening "Ready for QA" band is the bottleneck.

Common mistakes.

  • Measuring the average fix time: a few old bugs distort the number, and it matches no real case.
  • Drawing conclusions from a small sample: 2 reopened out of 5 is not a trend.
  • Using metrics to compare people: the reopen rate of "developer A" turns into an accusation, and data starts to be distorted.
  • Not fixing what each status means: "Ready for QA" with no rule for when a task gets there gives chaos in the data.
  • Collecting a metric without discussing it at the retro: a number without a conversation changes nothing.

Check yourself

The team’s rejected rate grew from 10% to 35%. Name two different possible causes and what you check in each case.

Answer

First: bugs are rejected as "not a bug" because requirements are unclear or have changed: I check what the reports refer to and whether there is a source of the expectation. Second: the share of duplicates or "cannot reproduce" has grown: I check whether people search for duplicates before filing and whether steps and environment are complete. A breakdown of rejected ones by reason (duplicate, not a bug, cannot reproduce) tells which one; without it the overall percentage explains nothing.

The average fix time of Major is 9 days and the median is 3 days. What does it mean and which number do you promise a customer?

Answer

A few very old bugs pull the average up: the typical task is done in 3 days. For a promise a percentile (for example, the 85th or 90th) is better, because it answers "how long can it take", not "how long on average". I look at the old bugs separately through the age of open bugs.

In an interview. Junior: I look at fix time by severity, the reopen rate, the rejected rate, test execution progress and how many tasks wait for QA. A high rejected rate suggests the problem is in requirements or in my reports, and it is a topic for the retro. Middle/Senior: I use the median and a percentile instead of the average, read metrics over several sprints and break down the reasons (reopen: not fixed or a regression; rejected: duplicate or not a bug). For a bottleneck I look at time in status, for example "Ready for QA", and propose process changes such as a WIP limit. I discuss metrics at the retro and do not use them to assess individual people.

Which metrics do you use for automation?

Automation metrics show coverage, trust, speed and effectiveness, not the number of tests. They include the share of automated regression (critical scenarios first), flaky rate, first-attempt pass rate, run time and main-branch stability. Retries hide instability in the final percentage. A flaky test gives different results on the same code, while a permanently red test is broken.

QA Fundamentals · Quality metrics

The automated tests are green, yet the team does not trust them and reruns twice. What to measure?

The pipeline is red, a developer clicks "Re-run" and the same test passes. A month later nobody investigates red any more: "it is flaky again". The automation formally works, but trust in it is lost, and with it the point. This lesson is about metrics that show the state of automation not by the number of tests but by usefulness and trust: what they mean, how to calculate them and where they deceive.

How it works and why. Automation exists to answer quickly and reliably the question "did we break anything". So its metrics group around three properties: whether it covers what is needed, whether it can be trusted and whether it is fast. A separate group is effectiveness: whether it really catches defects and pays off.

PropertyMetricHow to read it
Coveragethe share of automated regression cases, above all critical scenariosNot "how many tests" but whether what must not break is covered. Not every case is worth automating
Trustflaky rate; first-attempt pass rate; the share of red runs that turned out to be a test or environment errorThe goal for flaky rate is close to zero: otherwise red stops being a signal
Speedrun time (median and p90) and its trend; waiting time for PR feedbackA slow suite is run less often, and bugs are found later
Branch stabilitythe share of green runs on main; how long main stays redA red main blocks everyone, so recovery time matters
Effectivenessdefects found by automated tests; regressions that slipped past; maintenance costWhether automation pays off and catches what it was built for

A flaky test is a test that on the same code and the same conditions sometimes passes and sometimes fails. Its sign is not "sometimes fails" but "different result with no code change". So counting needs repeats on one commit: several runs, retries or the history of runs. Flaky rate is the share of tests (or runs) that showed such inconsistency.

A stable and a flaky test on one commit

checkout.spec: 10 runs, one commitsearch.spec: 10 runs, the same commitSame code, different result = flaky
Figure 1. A test that is red all the time is a broken test, not a flaky one: flaky is defined exactly by a different result on identical code.

Example: why "98% green" can be false comfort. Playwright can repeat failed tests (retries) and marks a test that passed only on retry as flaky in the report. This is useful, but retries hide the problem if you look only at the total:

// playwright.config.ts
import { defineConfig } from '@playwright/test';

export default defineConfig({
  retries: process.env.CI ? 2 : 0,
  reporter: [['html'], ['json', { outputFile: 'results.json' }]],
});
Nightly run, 300 tests, retries = 2

passed on the first attempt     276
passed only on retry (flaky)     18
failed finally                    6

pass rate after retries   = 294 / 300 = 98%
first-attempt pass rate   = 276 / 300 = 92%
flaky rate                =  18 / 300 =  6%

A 98% pass rate looks healthy, but on the first attempt 8% of tests fail (24 of 300), and 6% of all (18 tests) pass on retry, so they are flaky: behind each stand an extra run and somebody's time for a "Re-run". That is why the trust metric is calculated from the first attempt and flaky rate is tracked separately, not just the final percentage. Then a rule applies: a flaky test is neither ignored nor silently deleted. It is isolated (a separate suite or a mark that does not block the merge), given an owner and a deadline for the fix, and the metrics "number of tests in quarantine" and "age in quarantine" do not let them be forgotten. Deleting without analysis leaves a gap in coverage, and silent ignoring destroys trust in the whole suite.

Another metric often asked about is the ROI of automation. The calculation is simple in idea: the hours of manual regression saved in a period minus the costs of development, maintenance and infrastructure. For example, manual regression takes 16 hours and runs four times a month, which is 64 hours. If automation costs 12 hours of maintenance and some infrastructure, the saving is real. But the figure depends on assumptions (how many cases are really replaced, how much time goes into analysing reds), so it is presented as an estimate with assumptions, not as exact truth.

Limits and alternatives. The percentage of automation can be a wrong goal: 80% of automated cases that contain no critical scenarios are worse than 40% covering money and authorisation. So coverage is counted relative to risk. Run time is not minimised without limit either: a fast but incomplete suite gives false confidence. Defects found by automated tests show effectiveness but themselves depend on how many regressions occurred; zero found can mean both a poor suite and good code. As for fighting instability: data isolation, waiting for events instead of sleeps, a stable environment, deterministic time (see the lesson about a flaky test that blocks a merge).

Common mistakes.

  • Counting the number of automated tests as success: hundreds of small tests with no critical scenarios guarantee nothing.
  • Looking only at the pass rate after retries: flaky tests hide in the "green".
  • Turning off a flaky test with no owner and no deadline: coverage disappears quietly.
  • Not measuring maintenance time: automation that needs constant patching can cost more than a manual check.
  • Mixing flaky and broken tests: a test that is always red must be fixed like a bug, not added to flaky rate.

Check yourself

In CI the pass rate is 99% (with retries=2), yet developers say "the automated tests are unreliable". Which number do you calculate to check this, and why?

Answer

The first-attempt pass rate and the flaky rate (how many tests passed only on retry). Retries cover instability in the final percentage: a test that passed on the second attempt counts as green, but it spends time and erodes trust. The difference between "first attempt" and "after retries" is the measure of the hidden instability.

A test has failed in every run for three days. Do you count it in the flaky rate?

Answer

No. Flaky means a different result on identical code. A test that is always red is broken: it is a defect (in the product, in the test or in the data) that must be fixed like a bug. If it is counted as flaky, the metric loses its meaning, and a real problem gets the label "noise".

In an interview. Junior: For automation I look at the share of automated regression, flaky rate, run time, the pass rate on the main branch and how many regressions the automated tests really caught. Flaky rate is the most important to me: if a team stops trusting red tests, automation loses its point. Middle/Senior: I calculate the pass rate from the first attempt, because retries hide instability, and I separate flaky and broken tests. I isolate a flaky test with an owner and a deadline rather than turning it off silently. I measure coverage relative to risk, not by the number of tests, and I present ROI as an estimate with written assumptions.

Which metrics are harmful and why?

Metrics become harmful when they turn into personal targets: by Goodhart's law, when a measure becomes a target it ceases to be a good measure. Bugs per tester leads to tiny bugs and duplicates, a 100% pass rate to skips and deleted tests, a coverage target to tests without asserts. Metrics describe the team and the process, each gets a counter-metric, and numbers are a prompt to ask why.

QA Fundamentals · Quality metrics

Bonuses depend on the number of bugs found. A quarter later there are twice as many, quality the same?

Management introduces a KPI: a tester who finds more bugs gets a higher rating. Within a quarter the number of tickets doubles, but developers complain about small and duplicated reports, and production has as many problems as before. The metric worked: the number grew. Only it stopped meaning what it was introduced for. This lesson is about why this happens, which metrics are harmful as targets and how to turn them into safe ones.

How it works and why. Goodhart's law in Marilyn Strathern's wording: when a measure becomes a target, it ceases to be a good measure. A metric is useful while it is a side effect of real behaviour: the number of bugs found usually correlates with the quality of testing. As soon as an assessment or a bonus depends on the number, people optimise the number, not the behaviour it was meant to reflect. Nobody has to cheat: it is a natural reaction to an incentive. A metric that is measured, not rewarded, stays honest, while a metric-target gets distorted.

How a metric-target stops working

Step 1The number becomes a target:the rating depends on its value Step 2People optimise the number:split bugs, duplicate cases Step 3The number grows, quality does not:conflicts, noise, lost trust
Figure 1. The chain is the same for bugs, test cases and coverage: only what gets inflated changes.

What unites harmful metrics is not that they are "bad" but that they are easy to manipulate and that they set people against colleagues or against the goal. Typical examples, with what is done to them and what replaces them:

Metric as a targetWhat people doWhat to use instead
Bugs found per personSplit bugs, file trivia and duplicatesTeam leakage + rejected rate
Number of test casesCopy-paste, duplicated casesShare of critical scenarios with tests
100% pass rateSkips, deleted tests, retriesFirst-attempt pass rate + number of skips
Code coverage ≥ 90%Tests without assertionsA threshold on new changes + mutation testing
Zero bugs in productionHiding, reclassifyingLeakage trend + recovery time

Vanity metrics deserve a separate mention: numbers that look good but lead to no decision (the total number of test cases, the number of tests executed per day without context). They are safe but useless, and they occupy the place on a dashboard that useful ones should occupy.

Example: what an inflated metric looks like in the data. A team introduced the KPI "bugs per tester". The result for the quarter:

A quarter before the KPI "bugs per tester" → a quarter after

bugs filed               120  →  210
rejected (not a bug/dup)  15% →  38%
average description     9 lines → 3 lines
leakage (Major+)          11% →  12%

More tickets, fewer useful ones, the same number missed.

The signs of gaming the number are visible in the accompanying metrics: the rejected share grew from 15% to 38% (many duplicates and trivia), the description shrank from nine lines to three (reproduction steps suffer), and leakage did not change. There are more tickets and no more value. The cure is not to forbid counting but three practices. First, metrics describe the team and the process, not an individual person. Second, every metric gets a counter-metric that catches distortion: the number of bugs together with the rejected rate, coverage together with mutation testing, speed together with the change failure rate. Third, a metric is used for questions ("why?"), not for verdicts.

The same number as a target and as a signal

Target

Bugs per person: rating and bonus

People split bugs, duplicate them, do not share findings and argue with developers about counts. The number grows, trust falls.

Signal

Team leakage and rejected rate: a retro conversation

The number describes the system. If it got worse, the team asks "why?" and changes the process instead of looking for a culprit.

Figure 2. The difference is not in the number itself but in what depends on it.

Limits and alternatives. This does not mean counting is forbidden. Individual numbers are fine for the employee themselves and for a 1:1, as material for a conversation that analyses reasons and does not rank people. Sometimes a number really must be a target, for example a regulator's requirement or an SLA: then it is accompanied by checks that make gaming impossible or visible. The alternative to a target metric is a range and a trend: "leakage stays within 5-12%, a sharp deviation is analysed". Transparency helps too: when a team knows how a number is calculated and why, it is less inclined to distort it. Finally, remember Campbell's law, close to Goodhart's: the more a social decision depends on an indicator, the more it is subject to corruption pressure and the more it distorts the process it was meant to track.

Common mistakes.

  • Making the number of bugs or cases found a KPI: it distorts behaviour and spoils relations with development.
  • Setting "zero bugs in production" as a personal goal for QA: bugs start to be classified as "not ours", and releases become slow out of fear.
  • Introducing a metric without a counter-metric: a skew to one side is not visible until it does harm.
  • Comparing teams or people by metrics with different context: complex modules always "lose".
  • Not explaining how a metric is calculated: people invent their own explanations, and trust falls.

Check yourself

A manager proposes: "coverage must be at least 90%, otherwise we do not merge the PR". Which distortions do you expect and what do you add?

Answer

Tests without assertions that execute lines, tests for trivial code and bypassing the rule with exclusions. I add a counter-metric of the quality of checks: mutation testing for critical logic or a review of assertions, and I keep the threshold on new changes, not as a global goal, and not tied to a person’s rating.

Why does "zero bugs in production" as a personal goal for QA do harm even though it looks reasonable?

Answer

Because QA cannot fully control it: defects are introduced by development, requirements and the process. A person defends themselves: classifies bugs as "not mine" or "not bugs", blocks releases out of fear. Such a goal measures fear, not quality. A team trend of leakage with an analysis of reasons works better.

In an interview. Junior: I am careful with metrics such as the number of bugs found or cases written as a KPI. By Goodhart’s law, when a metric becomes a target, people optimise the number and not quality: bugs get split, cases get duplicated. Middle/Senior: Metrics must describe the system and the process, not assess people. I attach a counter-metric that catches distortion (the number of bugs with the rejected rate, coverage with mutation testing), look at trends and ranges, and use the numbers as a reason to ask "why".

How do you build a quality dashboard for different stakeholders?

A quality dashboard is built around each audience's decisions: the PM needs release or not, the team what to do today, management the quarterly trends. Each panel answers one question and shows a trend with context, and every number has a definition, a source and an update date. Details sit behind a link, and a short QA assessment complements the automatic numbers.

QA Fundamentals · Quality metrics

A PM asks "are we ready to release?" and the dashboard answers with fourteen charts. What is wrong?

Before a release a PM opens the QA dashboard and cannot find an answer to the single question they care about: can we release or not. Meanwhile the team needs something else: which tasks are stuck in "Ready for QA", and management needs a quarterly trend. One dashboard "for everyone" usually answers nobody. This lesson is about building a dashboard around the audience's questions, what to assemble it from and what spoils trust in it.

How it works and why. A dashboard is a set of answers to questions, not a visualisation of all data. So design starts with the audience and the decision it makes, and only then are numbers chosen. Different stakeholders make different decisions, so they need different answers.

AudienceDecisionWhat to showHow often
PM, businessDo we release, with what risksOpen blockers and critical bugs, regression state, production incidents of the latest releasesBefore a release, daily
Team (QA, development)What to do todayBugs by status, tasks in "Ready for QA", flaky tests, a red mainDaily
ManagementWhether process changes and investment are neededQuarterly trends: leakage, fix time, release stabilityMonthly or quarterly

Three principles follow. Each panel answers one question that can be phrased in words ("how many blockers are open?"). Show the trend and the context, not only the current value: "2 critical" says nothing, while "2 critical, it was 7 in the last release" is already a story. Each number has a definition and a source: what exactly is counted, from which query and when it was updated, otherwise two numbers from different places will diverge and trust will vanish.

A release readiness screen for a PM

Blockers0 openOKCritical2 openworkaroundRegression182 of 1908 not runVerdict: ready with conditionsThe PO makes the call
Figure 1. A sketch: three tiles with an answer and a verdict. The numbers are illustrative, details are behind a link.

Example: from "everything" to an answer to the question. The initial screen for a PM and the reworked one:

Before (the PM screen):        After (the PM screen):
  14 status counters           Blockers: 0 open
  a bug chart for the month    Critical: 2 open (workaround)
  number of test cases         Regression: 182 of 190, 8 not run
  a list of all open ones      Production incident trend: 3 releases
                               Link: the list of critical

The reworked screen answers the decision question: there are no blockers, critical ones have a workaround, regression is almost finished. The data is the same, but what moves the decision has been chosen, and details are available behind a link (drill-down). Technically such a screen is assembled from Jira filters (JQL) and dashboard gadgets:

-- open high-priority bugs in the current release
project = PAY AND issuetype = Bug AND fixVersion = "2.15"
  AND priority in (Highest, High) AND statusCategory != Done

-- production bugs in the last 30 days (for leakage)
project = PAY AND issuetype = Bug AND labels = production
  AND created >= -30d ORDER BY priority DESC

-- the "tail": open bugs older than 14 days
project = PAY AND issuetype = Bug AND resolution = Unresolved
  AND created <= -14d ORDER BY created ASC

Filters are saved as separate saved filters, and gadgets (a count by filter, a pie chart, a table) are added to the dashboard. For test data, Zephyr or Xray reports are used (execution by release, requirements coverage), for automated tests CI reports and Allure Report, and for trends over several quarters data is exported to Grafana or a BI tool, because Jira's built-in gadgets are weak on history. The "found in production" label or field is set up beforehand, otherwise there is nothing to calculate leakage from.

Limits and alternatives. A dashboard does not replace a conversation: a "green" screen does not guarantee that releasing is safe, so it complements, not replaces, the test report and the risks QA states in words. Automating a dashboard has a maintenance cost: filters break when a workflow changes, and stale data is worse than none, so each screen has an owner and an update date. The other extreme is manual reports: they are more accurate in content but expensive and late. The middle ground: automatic numbers plus a short written QA assessment for the release. Finally, do not show personal numbers on a shared screen, because they turn the dashboard into a tool of pressure (see the lesson about harmful metrics).

Common mistakes.

  • One dashboard for everyone: the PM drowns in details while the team lacks operational data.
  • Many numbers with no conclusion: a person has to invent the answer and will probably be wrong.
  • No definitions and no update date: the numbers diverge from the tracker, and the dashboard stops being trusted.
  • Only the current value with no trend or context: "12 open" does not say whether it is good or bad.
  • Colours without thresholds: "red" by feeling instead of an agreed limit devalues the signal.

Check yourself

A PM asks to "put everything about testing on the dashboard". What do you answer and how do you clarify the task?

Answer

I ask which decision the PM makes with this screen (release, priorities, resources) and which question has no answer right now. I propose a small number of tiles for it (blockers, critical, regression state, the production incident trend) with links to details. "Everything" answers no question and creates noise.

The dashboard shows 38 "open bugs" while the tracker shows 41 after filtering. Why is this dangerous and how do you avoid it?

Answer

A mismatch undermines trust in the whole dashboard: the next number will be checked by hand or ignored. Causes: different filters, a gadget cache, a changed workflow. Avoid it with a single definition of the number (which filter), a link to it on the panel itself, an update date and an owner of the dashboard.

In an interview. Junior: I build a dashboard for the audience. A PM needs an answer to whether the release is ready and what the blockers are, the team needs sprint progress and bug statuses, management needs quarterly trends. Technically these are JQL filters and gadgets in Jira, Zephyr or Xray reports and Allure for automated tests. Middle/Senior: I start from the decision the audience makes, and each panel answers one question with a trend and a threshold. Each number has a definition, a source and an update date, and the details are available behind a link. I complement the automatic numbers with a short written QA assessment, because a green screen is not yet a guarantee.

How do you prove quality improved? What are DORA metrics?

Improvement is proved with a baseline counted by the same rules, a named change, a trend over several releases and a counter-metric. DORA metrics measure delivery performance: change lead time, deployment frequency, failed deployment recovery time, change fail rate and deployment rework rate. Real improvement is a lower failure rate and leakage without losing speed, and DORA is combined with defect metrics.

QA Fundamentals · Quality metrics

A manager asks: "Have we really become better?" Which number do you show and why is one not enough?

After a quarter of changes (new contract tests, a regression test for every production fix) the team expects quality to have improved. To the question "is it so?" you want to show a single number: leakage fell. But that number can be explained differently: fewer changes shipped this quarter, the counting rules changed, or the release was just lucky. This lesson is about proving an improvement so that the conclusion survives questions, and about the DORA metrics that help with it.

How it works and why. Proof of improvement has four parts. First a baseline: the numbers before the changes, calculated by the same rules. Then a change: what exactly you did (otherwise it is a correlation without a cause). Then a trend over several releases (one release is nothing: noise, seasonality, volume). And finally a counter-metric: a check that the improvement was not bought at a high price, for example by slowing releases down or by downtime.

Four steps of proof

Step 1 · BaselineFix the numbers before the changewith the same counting rules Step 2 · ChangeName what exactly changedfor example, contract tests Step 3 · TrendCompare several releasesone release is noise Step 4 · Counter-metricCheck that speed did not fallrelease frequency, lead time
Figure 1. Missing any step leaves the conclusion without support: no baseline means no comparison, no counter-metric means stability may be bought at the price of speed.

DORA metrics are a set of software delivery performance indicators from the DORA research programme (DevOps Research and Assessment). Their idea is that speed and stability do not contradict each other: good teams have both. The current set consists of five metrics in two groups: in throughput they are lead time for changes (from commit to production), deployment frequency (how often we release) and failed deployment recovery time (earlier time to restore: how long we take to recover from a failed deployment); in instability they are change failure rate (the share of releases that caused an incident or a rollback; closest to QA) and deployment rework rate (the share of unplanned deployments made to fix a problem in production). The classic set of four did not have the last metric.

Two groups of DORA metrics

Speed

Throughput

Lead time for changes, deployment frequency, failed deployment recovery time. The question: how fast changes reach users and how fast we recover.

Stability

Instability

Change failure rate, deployment rework rate. The question: how often a release brings a problem and needs an unplanned fix.

Figure 2. A strong answer holds both groups: stability bought at the price of speed is not an improvement.

Example: two quarters and what can be claimed from them.

                                     Q1       Q2
leakage (Major+, 30-day window)      14%       8%
change failure rate                  18%       9%
deployment frequency            2 / week   3 / week
lead time for changes (median)    6 days    4 days
failed deployment recovery time   5 hours   2 hours

What changed in Q2: contract tests for the payments API
and a regression test for every fixed production defect.
Releases in each quarter: 6.

What can be said here. Leakage and change failure rate fell roughly by half, while deployment frequency and lead time improved: so stability grew not at the cost of speed. There is a named process change (contract tests and regression tests for fixes), and it logically links to what improved: escaped contract defects and repeated regressions. What cannot be claimed categorically: with six releases per quarter the difference may partly be noise, so it is worth waiting for one more quarter and checking that the volume and the mix of changes were comparable. So the wording for an interview: "the improvement looks real and is explained by a change, the next two quarters will confirm the trend".

Limits and alternatives. DORA measures delivery performance, not product quality directly, so it is combined with defect metrics (leakage, escaped defects by severity) and user-facing indicators (bug complaints, the share of crash-free sessions). Change failure rate depends on the definition of a "failed" release (rollback, hotfix, incident): if it is changed, the trend breaks, so the definition is fixed. All these metrics belong to a team, not a person: using DORA as a ranking of teams or as a KPI causes the same gaming of numbers (see the lesson about harmful metrics). For small teams with rare releases, instead of percentages it is better to look at individual incidents and analyse each one. If an improvement is not visible in the numbers, that is also a result: either the change does not work or the metric does not measure it.

Common mistakes.

  • Showing one number of one release as proof: it could be chance.
  • Changing the way of counting and comparing with the previous quarter: a distorted trend.
  • Ignoring the counter-metric: stability at the price of a two-month release freeze is not quality.
  • Not naming the cause: "it got better because it got better" convinces nobody, while a link to a concrete change gives a chance to repeat the success.
  • Making DORA a ranking of teams: numbers start to be bent to meet the bar.

Check yourself

Leakage fell from 14% to 8%, but deployment frequency fell from three a week to one. Is this an improvement?

Answer

Not necessarily. Stability was probably bought at the price of speed: rarer releases get more time for stabilisation, but changes pile up and reach users later. I look at change failure rate and lead time, and at whether a queue of changes has built up. I count as a real improvement a fall in leakage with unchanged or higher release frequency.

You have data for one release after the changes and a good number. What do you tell the manager and what do you do next?

Answer

I say the result is encouraging but one release is not yet a trend. I fix the baseline by the same rules, name the change I believe is the cause and compare several next releases. I also check the counter-metric (frequency and lead time) to make sure the improvement did not appear because speed dropped.

In an interview. Junior: I fix a baseline and show a trend over several releases, tied to a concrete process change. DORA metrics fit well: deployment frequency, lead time from commit to production, the share of failed releases, recovery time and the share of fix deployments. Middle/Senior: A real improvement is a fall in the share of failed releases and in leakage with unchanged or higher release frequency. I name the change that caused it, allow for noise on a small number of releases and use speed counter-metrics. I link DORA to defect metrics and user-facing indicators, because DORA measures delivery, not quality directly.