QA AND TEST AUTOMATION · PART 8 · CI/CD AND TEST INFRASTRUCTURE · STRATEGY · 78 OF 112

Quality Gates, Shift Left and Shift Right

Quality gates are the automatic rules a change must pass before it merges or ships: tests green, coverage on new code, static analysis, security and dependency scans, performance budgets, and a review. How to choose gates that catch real risk without blocking the team, what shift left and shift right mean in practice, and the tester's role in each, with ShopRung examples.

  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 / 11

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

Key takeaways

  • PR gate
  • release gate
  • gate on new code
  • fast, reliable, tied to risk
  • shift left: earlier
  • shift right: production

Notes

Pull request gate

A typical pull request gate. The build and lint pass. Unit, API and contract tests pass. Coverage of the new and changed code is at least, say, eighty percent. Static analysis finds no new blocker or critical issues. A dependency scan finds no new critical vulnerabilities, and a secret scan finds no leaked keys. And at least one reviewer approves. Branch protection makes all of these required.

Typical PR gate
  • build and lint pass
  • unit, API, contract tests pass
  • coverage on NEW code ≥ 80%
  • static analysis: no new blocker or critical issues
  • dependency scan: no new critical vulnerabilities
  • secret scan: nothing leaked
  • 1 approved review

Release gate

A release gate runs the slower checks before shipping. The full end to end suite on staging. No open critical or major bugs for this release. Performance within budget, for example ninety fifth percentile checkout time under eight hundred milliseconds. A dynamic security scan with no high findings. No serious accessibility violations. Then sign off, which some teams automate fully and others keep as a person's decision.

Typical release gate
  • full E2E suite on staging
  • no open critical or major bugs for this release
  • performance: p95 under budget (e.g. checkout < 800 ms)
  • security: DAST scan, no high
  • accessibility: no serious axe violations
  • sign-off: automatic or a person

New code

An important trick: gate on new code, not overall numbers. An older project might have forty percent coverage and two thousand old warnings. A gate on overall numbers stays red forever, so people start ignoring it. A gate on new code asks only that each change is clean, and the old debt shrinks over time. SonarQube, a common static analysis tool, calls this clean as you code.

Why "new code"
  • old project: 40% coverage, 2,000 old warnings
  • gate on overall numbers → red forever, ignored
  • gate on NEW code → every change must be clean the old debt shrinks slowly
  • SonarQube calls this "Clean as You Code"

Good gates

Choose gates carefully. Each one should match a real risk. PR gates must be fast. Gates must be reliable, because a flaky gate gets bypassed and then nobody trusts any of them. Each failure must say what to fix. Overrides should be rare and logged with a reason. And remember coverage is only a floor: a test can cover a line without checking anything, which is why mutation testing says more.

Choosing gates
  • tied to a real risk
  • fast: PR checks in minutes
  • reliable: a flaky gate gets bypassed
  • clear: says what to fix
  • rare overrides, logged with a reason
  • coverage is a floor, not a goal (mutation score says more)

Shift left

Shift left means testing earlier, when a problem costs least to fix. Testers join story refinement and ask what if questions before code exists: what if the coupon is applied at exactly fifty dollars? Acceptance criteria are written as examples with developers and the product owner. Tests ship in the same pull request as the feature. Static analysis runs in the editor, and contract tests catch integration breaks before environments exist.

Shift left in practice
  • testers in refinement: ask "what if" before code exists
  • acceptance criteria as examples (three amigos, BDD)
  • unit and API tests in the same PR as the feature
  • static analysis in the IDE
  • contract tests before integration

Shift right

Shift right means continuing to test after release, because production is where real users, data and load are. Synthetic monitors run a test journey every few minutes. Feature flags and canary releases expose a change to a few users first. Error tracking, logs and real user performance data show problems no test found. And every production bug becomes a new automated test. The next episode covers this in depth.

Shift right in practice
  • synthetic monitors: a test journey every few minutes
  • feature flags and canaries
  • error tracking, logs, metrics
  • real-user performance data
  • A/B tests
  • chaos experiments
  • production bugs → new tests

Both, for ShopRung

Here is both for a new ShopRung coupon, free ship. Shift left: in refinement, agree examples like seventy four ninety nine, exactly seventy five, and combined with save ten. In the pull request, unit tests for the rule and API tests, gated on new code coverage. Before release, the end to end checkout and a performance check. Shift right: turn the feature flag on for five percent of users, watch orders and errors, then everyone.

New coupon FREESHIP
  • left: examples in refinement ($74.99, $75.00, with SAVE10?)
  • PR: unit rules + API tests, gate on new-code coverage
  • release: E2E checkout + perf
  • right: flag on for 5% of users, monitor orders and errors, then 100%

Common mistakes

Gate mistakes. Gates on overall numbers that are always red. A hundred percent coverage as a target, which produces tests that assert nothing. Slow gates on every pull request. Flaky gates, so administrator merges become normal. And misreading shift left as testers stepping away. It means testers bring their skills earlier: asking questions, designing examples, and building checks into the pipeline.

Avoid these
  • gates on overall numbers that are red forever
  • 100% coverage as a target
  • slow gates on every PR
  • flaky gates, then "admin merge" becomes normal
  • "shift left" = testers leave testing to developers

Say it like this

In the interview: a pull request gate with build, unit, API and contract tests, coverage on new code, no new critical static analysis or dependency issues, a secret scan, and a review. A release gate with end to end tests on staging, a performance budget, a security scan, accessibility checks and no open critical bugs. Gates must be fast, reliable and tied to risk, with shift left examples before code and shift right monitoring after release.

In the interview
  • "PR gate: build, unit, API and contract tests, new-code
  • coverage, no new critical static
  • or dependency issues, secret
  • scan, review. Release gate: E2E
  • on staging, perf budget, DAST, accessibility, no open
  • criticals. Fast, reliable, tied
  • to risk. Plus shift left and right: examples, monitors."

Interview questions

Q1What is a quality gate?

An automatic rule a change must pass to merge or release, such as passing tests, new-code coverage, no critical static analysis or security issues.

Q2Why gate on new code instead of overall metrics?

Overall metrics on an older codebase stay red and get ignored; gating new code keeps each change clean and reduces debt over time.

Q3What belongs in a pull request gate?

Build, lint, unit, API and contract tests, new-code coverage, static analysis, dependency and secret scans, and a review.

Q4What belongs in a release gate?

Full E2E on staging, performance budgets, DAST, accessibility checks and no open critical bugs, then sign-off.

Q5What does shift left mean?

Testing earlier: testers in refinement, acceptance examples, tests in the same PR, static analysis and contract tests before integration.

Q6What does shift right mean?

Continuing to test in production: synthetic monitors, feature flags, canaries, error tracking, real-user data and chaos experiments.

Q7Is 100% coverage a good gate?

No. Coverage is a floor; it does not prove assertions. Use new-code coverage thresholds and mutation testing for test strength.

Q8What makes a gate bad?

Slow, flaky, unclear, or not tied to a real risk; teams then bypass it and stop trusting the pipeline.