QA AND TEST AUTOMATION · PART 11 · AI TOOLS FOR TESTERS · PRACTICE · 105 OF 112

AI in Testing: Traps, False Confidence, Fixes

The traps of using AI in testing, each one measured earlier in this course on ShopRung: plausible but wrong expected values, green tests that caught 0 of 10 bugs, keyword checks that passed bad answers, an unmeasured judge, a healed snapshot that made a bug the baseline, triage that called a bug "environment", secrets in snapshots and traces, and single runs. For each, the habit that fixes it.

  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

  • Exact but wrong
  • green, 0 of 10
  • unmeasured checkers
  • heals that accept bugs
  • triage labels
  • secrets
  • one run

Notes

Trap 1

Trap one: precise looking output. With a worked example in the prompt, the model gave exact amounts, and wrong ones: two dollars fifty off at fifty dollars, and a discount at forty nine ninety nine, where the coupon must be refused. Exact formatting makes errors harder to see. The fix: you choose the boundaries and compute every expected value from the requirement, with code for money.

Exact values, wrong answers
few-shot test cases:
  SAVE10 at $50.00 → "$2.50"
  (it is $5.00)
  $49.99 → discounted
  (it is refused)
fix: you choose boundaries and
  compute every expected value
  from the requirement

Trap 2

Trap two: green means tested. None of six AI written test files ran as written, and the four tests that passed after fixing caught none of ten planted bugs, because they never touched the boundary. Two hand written boundary tests caught the quantity bug at once. The fix: see every new test fail once on purpose, and grade suites with planted bugs or mutation testing.

AI-written cart tests
0 of 6 files ran as written
best one, fixed: 4 passed
against 10 planted bugs:
  0 caught
2 boundary tests by hand:
  caught quantity-limit
fix: see every new test fail
  once; grade with mutants

Trap 3

Trap three: checkers you never measured. Keyword checks passed two misleading answers in the golden set, and scored nine of nine before and after a real prompt regression. A naive LLM judge agreed with humans barely beyond chance, kappa zero point two eight; calibrated, zero point five two. The fix: measure every checker, keyword or judge, against human labels, and know what it misses.

Evals of the support chat
keyword checks: two misleading
  answers passed (golden set)
prompt regression, real model:
  keywords 9/9 before and after
naive LLM judge: kappa 0.28
calibrated judge: kappa 0.52
fix: measure every checker
  against human labels

Trap 4

Trap four: fixes that make the build green by changing what is expected. Updating a snapshot while the free shipping bug was on made the bug the baseline in a one line diff. Playwright's healer agent is instructed it may fix assertions and expected values to make a test pass. The fix: heal locators only, and put every change to an expected value through review with the requirement beside it.

Healing and updating
snapshot update during the
  free-shipping bug: green,
  one-line diff
healer instructions: "fixing
  assertions and expected
  values ... to pass the test"
fix: heal locators only, review
  every change to an expectation

Trap 5

Trap five: labels that send bugs away. AI triage got eight of twelve failure logs right with either prompt, never said unsure, and called a real performance bug an environment problem, the label that gets retried and forgotten. It also blamed the product for a broken test. The fix: deterministic rules first, AI as a suggestion with its reason, and a person deciding before anything is muted or filed.

AI failure triage
8 of 12 logs labelled right,
  naive or guided prompt
slow-search bug → ENVIRONMENT
wrong test → PRODUCT_BUG
never answered UNSURE
fix: rules first, AI suggests,
  a person decides

Trap 6

Trap six: secrets travel with the context. A password showed up in an MCP page snapshot, and a trace held the password and a login token. Our own masking script missed the password the first time. Everything an agent reads can end up with a provider and in logs. The fix: secret files for browser tools, test accounts only, local models for sensitive material, and a masking script with its own tests.

Found in this part
MCP snapshot: textbox
  "Password": Alice123!
trace.zip: Fill "Alice123!",
  Authorization: Bearer eyJ...
a masking script missed the
  password at first
fix: --secrets, test accounts,
  local models, tested masking

Trap 7

Trap seven: judging from one run. The same prompt made different mistakes on each of three runs, and once refused entirely. The same injection succeeded nine, two or ten times out of ten depending on the question. Malformed tool calls happened one run in three. One run tells you almost nothing about a model. The fix: repeat, report rates with their sample sizes, and be modest about small samples.

The same thing, run again
same test-case prompt, 3 runs:
  different mistakes each time
one run refused the task
injection with defences off:
  9/10, 2/10, 10/10 by question
malformed tool calls: 1 in 3
fix: repeat, report rates
  and sample sizes

The fix

The fix behind all seven is the same habit you apply to any system under test. Build a labelled sample of right answers. Measure the tool on it: agreement, bugs caught, rates over repeated runs. Put deterministic checks around it. Gate its output with review. Give every change a human owner. And measure again whenever the model, prompt or tool changes. AI in testing is a system to test.

Before trusting an AI tool
  • 1 a labelled sample: what is the right answer?
  • 2 measure: agreement, caught bugs, rates over runs
  • 3 checks around it: rules, allowlists, planted bugs
  • 4 review gates on its output
  • 5 a named human owner
  • 6 measure again after changes

Say it like this

In the interview: false confidence. AI output looks right, so people stop checking. I have seen exact but wrong expected values, green AI tests that caught none of ten planted bugs, judges and triage nobody measured, a healed snapshot that accepted a bug, and secrets in an agent's context. So I measure each AI tool on labelled cases, put checks and review gates around its output, and keep a human owner for every change.

In the interview
  • "False confidence. AI output
  • looks right: exact but wrong
  • expected values, green tests
  • that caught none of ten bugs, judges and triage we never
  • measured, healed tests that accepted a bug, and secrets in context. I measure each tool on labelled cases, gate its output
  • and keep a human owner."

Common mistakes

Here are the traps as questions to ask in any review. Who computed this expected value? Has this test ever failed? Was this checker measured against people? What exactly did the heal change? Who confirmed this triage label? What data did we send, and where? And how many runs is this result based on? If nobody can answer, the AI output is not ready to be trusted.

Ask before you trust
  • who computed this value?
  • has this test ever failed?
  • was this checker measured?
  • what did the heal change?
  • who confirmed this label?
  • what did we send, and where?
  • how many runs is this from?

Interview questions

Q1What is the main risk of AI in testing?

False confidence: output looks right (exact values, green tests, confident labels), so people stop checking.

Q2Give an example of precise but wrong AI output.

Few-shot test cases gave SAVE10 at $50.00 as $2.50 off (it is $5.00) and discounted $49.99, which must be refused.

Q3How do you know an AI-written test is worth keeping?

See it fail once on a planted bug and grade the suite with mutants: four green AI tests on ShopRung caught 0 of 10 bugs.

Q4Why measure checkers and judges?

Keyword checks passed misleading answers and a naive judge reached only kappa 0.28 against human labels.

Q5What can self-healing and snapshot updates do wrong?

Turn a bug into the baseline: updating a snapshot during the free-shipping bug made the test green with a one-line diff.

Q6Why not act on AI triage labels automatically?

It was right on 8 of 12 logs and labelled a real performance bug as environment, which gets retried and ignored.

Q7Where did secrets leak in this course?

Into a Playwright MCP snapshot (a password) and a trace (a password and a bearer token); a first masking script also missed the password.

Q8How do you decide whether to trust an AI tool?

Treat it as a system under test: a labelled sample, measured rates over repeated runs, deterministic checks, review gates and a human owner, re-measured after changes.