|
| 1 | +# AI Testing Interrogation — Expanded Question Bank |
| 2 | + |
| 3 | +When the grilling touches Dimension 4 (AI Integration), apply heightened scrutiny. AI in testing is powerful but introduces non-determinism, trust issues, and maintenance burdens that must be explicitly addressed. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## 4.1 Where does AI enter the testing workflow? |
| 8 | + |
| 9 | +### Interrogation points |
| 10 | + |
| 11 | +- **Test generation:** Is AI generating test code from specs, Gherkin, or natural language descriptions? |
| 12 | +- **Test healing:** Is AI auto-fixing broken selectors, assertions, or page structure changes? |
| 13 | +- **Visual regression:** Is AI being used for intelligent visual diffing (vs pixel comparison)? |
| 14 | +- **Triage & analysis:** Is AI analyzing test failures, grouping similar failures, or suggesting root causes? |
| 15 | +- **Test selection:** Is AI selecting which tests to run based on code changes? |
| 16 | +- **Test data generation:** Is AI generating test data, edge cases, or boundary values? |
| 17 | + |
| 18 | +### Recommended answer |
| 19 | + |
| 20 | +Adopt AI incrementally, lowest-risk first: |
| 21 | + |
| 22 | +1. **Triage** (lowest risk) — AI analyzes failures and groups them. Wrong output wastes time, doesn't cause false confidence. |
| 23 | +2. **Visual regression** — Mature technology. AI-assisted diffing reduces false positives vs pixel diff. |
| 24 | +3. **Test generation** (medium risk) — AI generates test drafts. Mandatory human review before merge. |
| 25 | +4. **Test healing** (higher risk) — Auto-fixing broken tests. Must be opt-in, logged, and reviewed. |
| 26 | +5. **Test selection** (highest risk) — AI decides what to test. Always maintain a fallback to full suite. |
| 27 | + |
| 28 | +Never deploy AI-based test selection without a safety net (random sampling of non-selected tests). |
| 29 | + |
| 30 | +--- |
| 31 | + |
| 32 | +## 4.2 How are AI-generated tests validated for correctness? |
| 33 | + |
| 34 | +### Interrogation points |
| 35 | + |
| 36 | +- Who reviews AI-generated tests before they are merged? |
| 37 | +- What criteria define a "correct" AI-generated test? |
| 38 | +- How do you verify the test is testing the right thing — not just passing? |
| 39 | +- What is the mutation testing strategy? (Can the test catch intentional bugs?) |
| 40 | +- How do you handle tests that pass for the wrong reason (tautological tests)? |
| 41 | + |
| 42 | +### Recommended answer |
| 43 | + |
| 44 | +Every AI-generated test must pass a four-gate review: |
| 45 | + |
| 46 | +1. **Behavioral gate:** Does the test verify the intended behavior? (Reviewer reads the test and confirms it matches the spec.) |
| 47 | +2. **Mutation gate:** Introduce a deliberate bug in the code under test. Does the test fail? If not, the test is worthless. |
| 48 | +3. **Stability gate:** Run the test 10 times. If it flakes even once, it fails. |
| 49 | +4. **Readability gate:** Can a new team member understand what the test does and why it exists without asking the author? |
| 50 | + |
| 51 | +AI-generated tests that fail any gate are rejected, not patched. Re-prompt and regenerate. |
| 52 | + |
| 53 | +--- |
| 54 | + |
| 55 | +## 4.3 What is the human-in-the-loop boundary? |
| 56 | + |
| 57 | +### Interrogation points |
| 58 | + |
| 59 | +- What decisions can the AI make autonomously? |
| 60 | +- What decisions require human approval? |
| 61 | +- Is there a "trust threshold" after which the AI gets more autonomy? |
| 62 | +- How is the audit trail maintained? (Who decided what, when?) |
| 63 | +- What happens when the AI and the human disagree? |
| 64 | + |
| 65 | +### Recommended answer |
| 66 | + |
| 67 | +Define clear autonomy tiers: |
| 68 | + |
| 69 | +| Tier | AI Action | Human Role | |
| 70 | +|------|-----------|------------| |
| 71 | +| 1 | Suggest | Human reviews and decides | |
| 72 | +| 2 | Draft | Human reviews, edits, approves | |
| 73 | +| 3 | Execute + log | Human reviews logs post-action, can revert | |
| 74 | +| 4 | Autonomous | No human review (reserved for lowest-risk, well-established patterns) | |
| 75 | + |
| 76 | +Start everything at Tier 1-2. A task can only advance to Tier 3 after 95%+ accuracy over 100+ executions with human verification. Tier 4 is reserved for deterministic, reversible actions (e.g., formatting test output). |
| 77 | + |
| 78 | +Maintain a complete audit log: every AI action records what was done, what prompt triggered it, what model was used, and what the outcome was. |
| 79 | + |
| 80 | +--- |
| 81 | + |
| 82 | +## 4.4 How are hallucinations and non-deterministic outputs mitigated? |
| 83 | + |
| 84 | +### Interrogation points |
| 85 | + |
| 86 | +- What temperature/decoding settings are used for test generation? |
| 87 | +- How are AI outputs validated against the actual application behavior? |
| 88 | +- What happens when the AI generates code that doesn't compile or references non-existent elements? |
| 89 | +- How do you handle AI tests that pass today and fail tomorrow (semantic drift)? |
| 90 | + |
| 91 | +### Recommended answer |
| 92 | + |
| 93 | +- Use low-temperature settings (0.0-0.3) for test generation to reduce randomness. |
| 94 | +- Validate every AI-generated selector/assertion against the live application during review. Never trust AI descriptions of UI structure. |
| 95 | +- For semantic drift: run AI-generated tests in a "canary" mode for 7 days before promoting to the main suite. If the test flakes or fails during canary, it is not ready. |
| 96 | +- Maintain a feedback loop: track AI test quality metrics (rejection rate, post-merge flakiness, mutation score) and feed back into prompt engineering. |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +## 4.5 What is the cost/token budget for AI-assisted testing? |
| 101 | + |
| 102 | +### Interrogation points |
| 103 | + |
| 104 | +- What is the per-PR cost of AI test generation? |
| 105 | +- What is the monthly cost of AI triage/analysis? |
| 106 | +- How is cost tracked and attributed? |
| 107 | +- What happens when the budget is exceeded? |
| 108 | +- Are there fallback strategies when AI is unavailable (rate limits, outages)? |
| 109 | + |
| 110 | +### Recommended answer |
| 111 | + |
| 112 | +- Track AI cost per category: generation, triage, healing, selection. |
| 113 | +- Set a monthly budget with alerts at 50%, 75%, and 100%. |
| 114 | +- When budget is exceeded: generation stops (falls back to manual), triage continues (low cost), healing continues (high value). |
| 115 | +- Always maintain a non-AI fallback path for every workflow. If the AI provider is down, tests must still run, triage must still happen (manually), and the pipeline must not break. |
| 116 | +- Cost efficiency metric: cost per valid test generated. If AI generates 100 tests at $50, but only 20 pass all four gates, the real cost is $2.50 per valid test. Track this. |
| 117 | + |
| 118 | +--- |
| 119 | + |
| 120 | +## 4.6 What AI tools are selected and why? |
| 121 | + |
| 122 | +### Interrogation points |
| 123 | + |
| 124 | +- What tools were evaluated? (GitHub Copilot, Cursor, Claude, ChatGPT, specialized tools) |
| 125 | +- What are the selection criteria? (accuracy, integration, cost, ecosystem, security) |
| 126 | +- Does the tool support the team's framework and language? |
| 127 | +- Is the tool's output deterministic enough for CI use? |
| 128 | +- What is the vendor lock-in risk? |
| 129 | +- How does the tool handle proprietary or sensitive code? |
| 130 | + |
| 131 | +### Recommended answer |
| 132 | + |
| 133 | +Document a tool comparison matrix with these criteria: |
| 134 | + |
| 135 | +1. **Accuracy** — Mutation score of generated tests (objective metric) |
| 136 | +2. **Integration** — Does it work with the existing framework/CI/IDE? |
| 137 | +3. **Cost** — Per-developer or per-request pricing |
| 138 | +4. **Security** — Does the tool train on your code? Is data sent to external servers? |
| 139 | +5. **Determinism** — Same input, same output? (Critical for CI reproducibility) |
| 140 | +6. **Portability** — Can you switch tools without rewriting all tests? |
| 141 | + |
| 142 | +Prefer tools that integrate with the existing IDE and CI pipeline over standalone tools. Avoid tools that require sending proprietary code to external servers without explicit security review. For test generation specifically, evaluate with a standardized benchmark (e.g., generate tests for 10 known features and score the output). |
| 143 | + |
| 144 | +--- |
| 145 | + |
| 146 | +## 4.7 Ownership: Who owns the test — the human or the AI tool? |
| 147 | + |
| 148 | +### Interrogation points |
| 149 | + |
| 150 | +- If an AI-generated test fails in production, who is responsible? |
| 151 | +- Is there a code ownership header or annotation on AI-generated tests? |
| 152 | +- How are AI-generated tests maintained over time? |
| 153 | +- Can the same AI tool update the test later, or must a human do it? |
| 154 | + |
| 155 | +### Recommended answer |
| 156 | + |
| 157 | +- **Humans own all tests, regardless of how they were created.** AI is a tool, not an author. |
| 158 | +- Every AI-generated test must have a human owner (code ownership annotation or team assignment). |
| 159 | +- Tag AI-generated tests in the test metadata (e.g., `@ai-generated @reviewed-by:username`) for tracking quality over time. |
| 160 | +- When an AI-generated test breaks, the human owner is responsible for fixing it — not delegating back to the AI tool. If the human cannot understand the test well enough to fix it, the test should be deleted and rewritten. |
| 161 | +- Track AI vs human test quality metrics separately: flakiness rate, bug detection rate, maintenance cost. If AI tests are consistently lower quality, adjust the generation strategy. |
0 commit comments