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

QA Fundamentals › Quality metrics

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.

More articles in this chapter