QA AND TEST AUTOMATION · PART 12 · LEADING QUALITY (SENIOR AND STAFF) · METRICS · 108 OF 112

Quality Metrics: Escape Rate, DORA, Flakiness

The few metrics that show whether testing works, and the ones that mislead. Measured on ShopRung's suites: a planted-bug detection rate of 14 of 17, zero flaky results in 530 repeated test runs (yet up to 5 failures of 23 once tests ran in parallel), feedback in about 7 seconds. Plus defect escape rate and the four DORA metrics, how to compute them, and how teams game numbers.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. 45
  46. 46
  47. 47
  48. 48
  49. 49
  50. 50
  51. 51
  52. 52
  53. 53
  54. 54
  55. 55
  56. 56
  57. 57
  58. 58
  59. 59
  60. 60
  61. 61
  62. 67
  63. 68
  64. 69
  65. 70
  66. 71
  67. 72
  68. 73
  69. 74
  70. 75
  71. 76
  72. 77
  73. 78
  74. 79
  75. 80
  76. 81
  77. 82
  78. 83
  79. 84
  80. 85
  81. 86
  82. 87
  83. 88
  84. 89
  85. 90
  86. 91
  87. 92
  88. 93
  89. 94
  90. 95
  91. 96
  92. 97
  93. 98
  94. 99
  95. 100
  96. 101
  97. 102
  98. 103
  99. 104
  100. 105
  101. 106
  102. 107
  103. 108
  104. 109
  105. 110
  106. 111
  107. 112
1 / 12

Press play to hear the narration, or step through at your own pace.

Key takeaways

  • Detection 14/17
  • escapes by severity
  • 0 flaky in 530 runs
  • ~7 s feedback
  • DORA four
  • counter-metrics

Notes

Detection

First, can the tests catch bugs at all? Coverage cannot answer that; planted bugs can. ShopRung's suites caught fourteen of its seventeen planted bugs, eighty two percent, and the three misses are named. It works like a mutation score for the whole product. Track it when tests or the product change, and add a planted bug, or a mutant, for every real bug you fix.

Planted-bug detection rate
ShopRung, 17 planted bugs,
  5 suites + load tests:
caught by at least one: 14
rate: 14 / 17 = 82%
missed: rounding, name
  length, slow chat
like mutation score, for the
  whole product

Escapes

Second, escapes: bugs found after release, divided by all bugs found for that release. Count them by severity, because ten cosmetic escapes matter less than one money bug. The useful part is not the rate but the question each escape asks: which test should have caught this, and why did it not? ShopRung's off topic refusal bug, found by the red team after the chat shipped, is an escape: its review gave a new test and a fix.

Defect escape rate
  • escapes = bugs found after release / all bugs found for that release
  • count by severity, not just totals
  • every escape: which test should have caught it?
  • ShopRung example: the role-play refusal bug, found by the red team after the chat shipped

Flakiness

Third, flakiness: tests that fail without a code change. We ran ShopRung's API suite twenty times and the UI suite ten times: five hundred and thirty test runs, zero flaky. But the same API suite run with four parallel workers failed two, four and five of twenty three tests, because tests shared data, and the lab seven suite passed only two of ten runs in random order. Flakiness depends on how you run tests, so measure it the way CI runs them.

ShopRung suites, run again
API suite x 20 runs:
  460 test runs, 0 flaky
UI suite x 10 runs:
  70 test runs, 0 flaky
API suite, 4 workers in
  parallel: 2, 4 and 5 of 23
  failed (shared data)
lab 7 suite, random order:
  2 of 10 runs passed

Feedback time

Fourth, feedback time: how long a developer waits to learn whether a change broke something. ShopRung's pull request suites took about seven seconds: the API suite under two, the UI suite under four, the AI suites on the fake model under one. On real projects, track the median and the ninety fifth percentile of the whole CI job. When feedback takes too long, people merge without waiting, and every other metric decays.

Pull request feedback
API suite      1.6 to 2.0 s
UI suite       3.7 to 3.9 s
AI suites, fake model  < 1 s
total about 7 s on a laptop

track the p50 and p95 of the
  whole CI job, not one suite
slow feedback → people stop
  waiting for it

DORA

DORA, from the DevOps Research and Assessment program, measures delivery with four metrics. Two for throughput: how often you deploy, and how long a change takes from commit to production. Two for stability: the share of deployments that cause a failure in production, and how long it takes to restore service. Testers influence all four: fast reliable suites raise throughput, and good tests lower the change failure rate.

The four DORA metrics
  • throughput: deployment frequency lead time for changes (commit → production)
  • stability: change failure rate time to restore service
  • measured from deploys, incidents and Git, per team

Compute them

You can compute them from data that already exists. Deployment frequency from the deploy jobs in CI. Lead time as the median from a commit's time to the deployment that shipped it. Change failure rate as deployments that caused an incident or rollback, divided by all deployments. Time to restore as the median from an incident opening to its resolution. Compare a team with itself over time, never teams with each other.

Where the numbers come from
deployment frequency:
  CI deploy jobs per week
lead time: commit time →
  deploy time, median
change failure rate:
  incidents or rollbacks /
  deployments
time to restore: incident
  opened → resolved, median

Gaming

Every metric can be gamed. Test counts rise by splitting tests. Coverage rises with tests that assert nothing. Pass rate rises by quarantining failures. Bug counts rise with duplicates, and escapes fall when bugs are renamed feature requests. Pair each metric with a counter metric: pass rate with the number of quarantined tests, coverage with the mutation score, speed with the change failure rate.

How numbers mislead
  • test count: split tests, test nothing new coverage %: tests without assertions
  • pass rate: quarantine or skip the failures
  • bugs found: report duplicates
  • escapes: reclassify bugs as "feature requests"
  • fix: pair each metric with its counter-metric

A dashboard

A practical dashboard has few numbers. Escape rate by severity. Detection, as a planted bug or mutation score. Flaky tests: how many, and how long they have sat in quarantine. Pull request feedback time at the ninety fifth percentile. And the four DORA metrics. Each needs an owner, a target, a trend, and the decision it drives, or it will be watched by no one.

A quality dashboard
  • escape rate by severity
  • planted-bug or mutation score
  • flaky tests: count and age in quarantine
  • PR feedback time, p95
  • DORA four, per team
  • each: an owner, a target, a trend, and the decision it drives

Common mistakes

Mistakes. Counting tests or bugs as if more were better. Making coverage the goal. Measuring flakiness in a different way from how CI runs the tests. Comparing teams with each other using DORA. Collecting metrics that change no decision. And setting targets so hard that hitting the number becomes the job, instead of quality.

Avoid these
  • counting tests or bugs
  • coverage as the goal
  • flakiness measured one way, CI run another
  • comparing teams with DORA
  • metrics without decisions
  • targets that become the job

Say it like this

In the interview: escaped bugs by severity, with a review of each one. A detection score from planted bugs or mutants: on our shop, the suites caught fourteen of seventeen. Flaky tests and how long they sit in quarantine, measured the way CI runs them. Pull request feedback time. And the DORA metrics per team, over time. Each paired with a counter metric so it cannot be gamed.

In the interview
  • "Escapes by severity, and a review of each one. A planted- bug or mutation score: our suites caught 14 of 17. Flaky
  • tests and quarantine age, run
  • the way CI runs. PR feedback
  • time. And DORA per team. Each paired with a counter-metric so it cannot be gamed."

Interview questions

Q1What is a defect escape rate?

Bugs found after release divided by all bugs found for that release, best tracked by severity, with a review of each escape.

Q2How can you measure whether tests catch bugs?

With planted bugs or mutation testing: ShopRung's suites caught 14 of 17 planted bugs (82%).

Q3How do you measure flakiness?

Repeat the suite the way CI runs it and count tests that fail without a change: 0 in 530 serial runs on ShopRung, but 2 to 5 of 23 failed with 4 parallel workers.

Q4What are the four DORA metrics?

Deployment frequency, lead time for changes, change failure rate and time to restore service.

Q5How do testers influence DORA metrics?

Fast, reliable suites raise deployment frequency and cut lead time; good tests lower the change failure rate.

Q6Why is code coverage a weak goal?

It rises with tests that assert nothing; pair it with a mutation or planted-bug score.

Q7How are quality metrics gamed?

Splitting tests, quarantining failures, reporting duplicates, renaming bugs; pair each metric with a counter-metric.

Q8Should you compare teams with DORA metrics?

No: compare each team with itself over time; contexts differ too much between teams.