AI Test Case Generation from Requirements: A Review Workflow
A review workflow for AI test case generation, shown on a real example: a typical draft agreed with the rules in every case yet caught 5 of 12 seeded defects, and a reviewed suite caught all 12.
Hely PatelHead of Product and Marketing18 min read
AI test case generation turns a written requirement into a draft set of test cases in seconds. The draft is usually correct and usually incomplete. A reliable workflow has four steps: make the requirement testable, generate a draft, review it against a coverage matrix and add the missing cases.
In the worked example below, a typical 14-case draft agreed with the business rules every time and still caught only 5 of 12 seeded defects. After review added 8 boundary cases, the suite caught all 12. This is the difference between an AI test case generator that saves time and one that creates false confidence.
Who this is for: QA engineers, test leads and business analysts who generate test cases from requirements or user stories with an AI assistant. What you get: a repeatable workflow, a copy-paste generation template, a review checklist and two small scripts you can run on your own cases.
How does AI test case generation work?
You give a model a requirement, a user story or an acceptance criterion, and it returns test cases: titles, steps, inputs and expected results. The quality of the output depends on three things: how testable the requirement is, how precisely you specify the case format and categories, and how the result is reviewed. The model contributes breadth and speed. The tester contributes what the requirement leaves out.
Two ideas from the research on LLM test case generation explain why review matters.
Ambiguity is the central problem. A 2026 survey of 21 primary studies on generating tests from natural-language requirements names ambiguity as the core challenge. A 2026 paper in Frontiers in Artificial Intelligence treats ambiguity as an "oracle-design problem" as well as a language problem, because a model that guesses the intended behaviour can write assertions that contradict it.
Execution makes generated tests trustworthy. The same paper tested generation on 25 Python tasks with four kinds of ambiguity each, 100 instances in all. Generation-only baselines produced tests that failed the reference implementation on 51 to 68 percent of instances. Adding execution feedback against a reference implementation brought that to zero, and removing execution verification from the full workflow dropped its effective mutation score from 0.678 to 0.216. The authors also state the limits: the method needs an accepted reference implementation, it covers function-level tasks and a pass against the reference shows compatibility, not stakeholder agreement.
The practical reading is the one this guide follows: run generated cases against something real, and measure whether they would catch defects. Other studies point the same way. Work on LLM unit-test oracles reports a mutation score close to developer-written tests in one setting, while a separate 2026 study reports only 56 to 59 percent of generated tests passing on average. Results vary by task and model, which is the reason to measure on your own rules.
Can you trust AI-generated test cases?
You can trust them as a draft and verify them as a suite. In our example, correctness and effectiveness came apart: all 14 draft cases were right, and the suite still let 7 of 12 planted defects through. Nothing in the draft signalled this. The sections below show how to find the gaps.
The worked example: a leave application rule set
The example is deliberately ordinary, because ordinary rules are where teams use this technique. A leave form has eight rules.
# Leave application rules (v1.0)
LV-1 Two leave types exist: Casual Leave (CL) and Sick Leave (SL).
LV-2 Duration is counted in working days, Monday to Friday. A half day (0.5) is allowed only for a single-day request.
LV-3 CL must be applied at least 2 days before the start date. SL has no notice period.
LV-4 A CL request may not exceed 5 working days.
LV-5 A request may not exceed the available balance. A request equal to the balance is allowed.
LV-6 SL of more than 2 working days requires a medical certificate.
LV-7 A request that overlaps an approved leave is rejected. Sharing a single date counts as overlap.
LV-8 The end date may not be before the start date, and the start date may not be before the application date.
A small reference implementation, leave.py, acts as the product under test. We then planted 12 defects, one at a time, each a realistic mistake: an off-by-one on a notice period, a cap of 6 instead of 5, calendar days counted instead of working days, an exact balance rejected and similar. A suite scores by how many of the 12 defective versions it catches. This is mutation testing in miniature, and it measures what coverage percentages cannot: whether the suite would notice if the product were wrong.
Step 1: How do you make a requirement testable?
The most useful step happens before generation. A model, like a person, fills vague wording with assumptions. Here is the first version of the rules, as a busy analyst might write them.
# Leave application rules (first draft from the business)
LV-1 Employees can take casual leave and sick leave.
LV-2 Leave is counted in days. Half days are allowed where appropriate.
LV-3 Casual leave needs reasonable notice. Sick leave can be taken quickly.
LV-4 Casual leave cannot be too long.
LV-5 A request cannot be more than the balance.
LV-6 Long sick leave needs a certificate.
LV-7 Overlapping requests are not allowed, etc.
LV-8 Dates must be valid.
A short script flags wording that cannot be tested. It looks for vague words and nothing else, which keeps it predictable.
"""Flag wording that a test case cannot be derived from. Usage: python3 lint_requirements.py FILE"""
import re, sys
VAGUE = ["reasonable", "appropriate", "quickly", "too long", "long", "etc", "as needed", "where possible",
"valid", "a few", "several", "soon", "large", "small", "user-friendly", "normal", "properly", "efficient"]
bad = 0
for n, line in enumerate(open(sys.argv[1]), 1):
if not re.match(r"LV-\d+", line): continue
hits = [w.strip() for w in VAGUE if re.search(r"\b" + re.escape(w.strip()) + r"\b", line, re.I)]
if hits:
bad += 1
print(f"line {n}: {line.split()[0]} vague wording: {', '.join(hits)}")
print(f"{bad} of 8 requirements need clarification" if bad else "no vague wording found")
sys.exit(1 if bad else 0)
line 4: LV-2 vague wording: appropriate
line 5: LV-3 vague wording: reasonable, quickly
line 6: LV-4 vague wording: too long, long
line 8: LV-6 vague wording: long
line 9: LV-7 vague wording: etc
line 10: LV-8 vague wording: valid
6 of 8 requirements need clarification
Six of eight requirements need clarification. "Too long" does not say whether 5 days is allowed. "Reasonable" and "quickly" do not give a notice period. "Etc" hides cases. The clean version above replaces each with a number or a rule, and the same script reports it clean:
no vague wording found
The lint output is a conversation starter with the author of the requirement. It turns "the AI missed the notice rule" into "the notice rule was never stated", which is the cheapest defect you will ever fix.
Two questions remain that the written rules cannot answer: what happens to a request that covers only a weekend, which counts as zero working days, and how public holidays are handled. No generator can settle them. Put them on a list for the product owner, and treat a workflow that surfaces open questions as better than one that buries them in confident-looking cases.
A requirement quality checklist
Check
Weak
Testable
Numbers instead of adjectives
"reasonable notice"
"at least 2 days before the start date"
Inclusive or exclusive stated
"up to 5 days"
"may not exceed 5 days", so 5 is allowed
Units stated
"short leave"
"0.5 or 1 working day"
Every rule has an identifier
A paragraph of prose
LV-1 to LV-8
Lists are closed
"etc", "and so on"
A complete list of the cases
Outcomes stated
"is handled"
"is rejected with an error"
Dependencies stated
Balance is assumed
"a request equal to the balance is allowed"
Step 2: What should you ask the model for?
A generation request has five parts. Copy and adapt this template.
Role: You are a QA engineer writing test cases from a requirement.
Requirement (each rule has an ID):
<paste the cleaned requirement>
Output: a JSON array. Each case has: id, req (rule IDs), category
(positive, negative or boundary), title, input (concrete values for every
field), expected (outcome and error code or value).
Coverage:
- For every rule, give at least one positive and one negative case.
- For every rule with a number, date or limit, give boundary cases: the
value just below, on and just above the limit.
- Vary the state the rules depend on (balances, existing records, dates).
Rules about your answer:
- Use concrete values, never placeholders such as "valid date".
- Do not invent behaviour. If the requirement does not say what happens,
add the question to an "open_questions" list instead of a test case.
- Do not repeat cases that test the same rule with the same class of input.
This is a template, and we did not measure it against a specific model. Its purpose is to cover the five things a draft needs: a fixed format so cases can be run, explicit categories, the state to vary, a ban on invented behaviour and a place for open questions. The last two matter most. Models fill gaps confidently, and an "open questions" list gives them a way to stop.
You can run this in a chat assistant, or use Test Suite Studio, which turns requirements into structured scenarios you edit and approve before they enter a suite. For form-heavy requirements, Form Filling Genius supplies realistic and edge-case values for the inputs, so generated cases have real data to run against.
A single case in the format above:
{
"id": "TC-03",
"req": "LV-3",
"category": "negative",
"title": "Casual leave applied 1 day before the start is rejected",
"input": {"kind": "CL", "start": "2026-12-02", "end": "2026-12-03",
"applied_on": "2026-12-01", "balance": 10, "cert": false,
"half": false, "existing": []},
"expected": ["rejected", "E_NOTICE"]
}
Concrete inputs matter. "Apply leave with insufficient notice" cannot be executed or checked. A case with dates and a balance can.
Which test design techniques should you ask for? Boundary value analysis and more
Naming the technique gives the model, and the reviewer, a target.
Technique
What it produces
Example from the leave rules
Equivalence partitioning
One case per class of input
CL, SL and half-day as separate classes
Boundary value analysis
Cases below, on and above each limit
Notice of 1, 2 and 3 days. CL of 4, 5 and 6 working days
Decision table
Cases for combinations of conditions
Leave type by duration by certificate
State-based testing
Cases that depend on stored state
Balance of 0.5 with a half day. An existing approved leave
Error guessing
Cases from common mistakes
A weekend-spanning request. Same-day sick leave
For LV-3 alone, boundary value analysis gives three cases: 1 day of notice (rejected), 2 days (approved, the boundary) and 3 days (approved). The 14-case draft contained only the first. That absence is the finding.
Beyond the review itself, a team can feed this approach with user stories as well as formal requirements: write the acceptance criteria with numbers and states, and generate test cases from user stories the same way. The quality ceiling is set by the story, not the tool.
Step 3: How do you review generated test cases?
Review against a matrix, not an impression. The checker has two jobs: it runs every case against the reference rules to confirm the expected results are right, and it builds a coverage matrix of cases per requirement and category.
"Run a case file against the reference rules and against 12 seeded defects. Usage: python3 check_cases.py cases.json"
import json, sys
from leave import apply_leave, MUTANTS
cases = json.load(open(sys.argv[1]))
REQS = [f"LV-{i}" for i in range(1, 9)]
def run(case, mutant=None):
return list(apply_leave(**case["input"], mutant=mutant))
# 1. Do the cases agree with the reference rules?
wrong = [c["id"] for c in cases if run(c) != c["expected"]]
print(f"Cases: {len(cases)} agree with the reference rules: {len(cases) - len(wrong)} disagree: {len(wrong)}")
for w in wrong: print(" disagrees:", w)
# 2. Requirement coverage by category
print("\nRequirement positive negative boundary")
cov = {r: {"positive": 0, "negative": 0, "boundary": 0} for r in REQS}
for c in cases:
for r in c["req"].split(","): cov[r.strip()][c["category"]] += 1
for r in REQS:
v = cov[r]; gap = " <- no boundary case" if v["boundary"] == 0 else ""
print(f"{r:<12} {v['positive']:^8} {v['negative']:^8} {v['boundary']:^8}{gap}")
# 3. Does the case set catch each seeded defect?
print("\nSeeded defect caught by")
killed = 0
for m, text in MUTANTS.items():
hit = [c["id"] for c in cases if run(c, m) != c["expected"]]
killed += bool(hit)
print(f"{m} {text:<58} {', '.join(hit[:3]) if hit else 'NOT CAUGHT'}")
print(f"\nDefects caught: {killed} of {len(MUTANTS)}")
The output for the 14-case draft:
Cases: 14 agree with the reference rules: 14 disagree: 0
Requirement positive negative boundary
LV-1 2 0 0 <- no boundary case
LV-2 2 1 0 <- no boundary case
LV-3 0 1 1
LV-4 1 1 0 <- no boundary case
LV-5 0 1 0 <- no boundary case
LV-6 2 1 0 <- no boundary case
LV-7 0 1 0 <- no boundary case
LV-8 0 2 0 <- no boundary case
Seeded defect caught by
M01 LV-3 notice check uses > 2 instead of >= 2 NOT CAUGHT
M02 LV-3 notice rule also applied to sick leave TC-02, TC-07, TC-08
M03 LV-4 cap is 6 instead of 5 TC-04
M04 LV-4 counts calendar days instead of working days NOT CAUGHT
M05 LV-5 exact balance is rejected (>= instead of >) NOT CAUGHT
M06 LV-6 certificate required from 2 days instead of more than 2 NOT CAUGHT
M07 LV-6 certificate also required for casual leave TC-01, TC-05, TC-09
M08 LV-7 touching dates are not treated as overlap NOT CAUGHT
M09 LV-2 weekends are counted as working days NOT CAUGHT
M10 LV-2 half day accepted on a multi-day range TC-13
M11 LV-8 same-day sick leave is rejected NOT CAUGHT
M12 LV-8 end date before start date is not checked TC-10
Defects caught: 5 of 12
Read it in three passes.
Correctness: 14 of 14 agree. Every expected result matches the reference. A reviewer reading the list would approve it, and this is where many teams stop.
Coverage: only LV-3 has a boundary case. Seven of eight requirements have none, and boundaries are where off-by-one defects live. The cap, the balance, the certificate threshold and the overlap rule are all boundary rules.
Effectiveness: 5 of 12 defects caught. Seven defective versions of the product pass this suite. The draft is accurate and weak, which is the combination that hides risk, because accuracy is the thing a reader can see.
Step 4: Which cases do you add?
Each "no boundary case" flag and each NOT CAUGHT row points at a specific case. The review added eight, TC-15 to TC-22:
New case
Rule
What it checks
TC-15
LV-3
CL applied exactly 2 days before the start is approved
TC-16
LV-3, LV-8
SL applied on the start date is approved
TC-17
LV-4
CL of exactly 5 working days is approved
TC-18
LV-2, LV-4
CL of 5 working days spanning a weekend (7 calendar days) is approved
TC-19
LV-5
A request equal to the balance is approved
TC-20
LV-6
SL of exactly 2 working days without a certificate is approved
TC-21
LV-7
A request sharing one date with an approved leave is rejected
TC-22
LV-2, LV-5
A half day equal to a balance of 0.5 is approved
Re-running the checker on the 22-case suite:
Cases: 22 agree with the reference rules: 22 disagree: 0
Requirement positive negative boundary
LV-1 2 0 0 <- no boundary case
LV-2 2 1 2
LV-3 0 1 3
LV-4 1 1 2
LV-5 0 1 2
LV-6 2 1 1
LV-7 0 1 1
LV-8 0 2 1
Seeded defect caught by
M01 LV-3 notice check uses > 2 instead of >= 2 TC-15
M02 LV-3 notice rule also applied to sick leave TC-02, TC-07, TC-08
M03 LV-4 cap is 6 instead of 5 TC-04
M04 LV-4 counts calendar days instead of working days TC-18
M05 LV-5 exact balance is rejected (>= instead of >) TC-19, TC-22
M06 LV-6 certificate required from 2 days instead of more than 2 TC-20
M07 LV-6 certificate also required for casual leave TC-01, TC-05, TC-09
M08 LV-7 touching dates are not treated as overlap TC-21
M09 LV-2 weekends are counted as working days TC-18
M10 LV-2 half day accepted on a multi-day range TC-13
M11 LV-8 same-day sick leave is rejected TC-16
M12 LV-8 end date before start date is not checked TC-10
Defects caught: 12 of 12
Draft
Reviewed
Cases
14
22
Agree with reference rules
14 of 14
22 of 22
Requirements with a boundary case
1 of 8
7 of 8
Seeded defects caught
5 of 12
12 of 12
Eight added cases moved detection from 42 percent to 100 percent. LV-1 still has no boundary case, which is acceptable, because it defines the two leave types and has no edge. Asking a model for "more test cases" tends to produce more happy paths. Review that finds the right eight is cheaper than a longer draft.
What does a review of AI generated test cases quality look for?
Drafts fail in recognisable ways. Knowing the patterns turns review into a short list of questions.
Pattern
What it looks like
Question to ask
Happy-path clustering
Most cases are valid requests that succeed
Which cases would fail, and where is the edge between them?
Missing boundaries
A rule has a number and no case sits on or beside it
Is there a case below, on and above the limit?
Assumed defaults
Inputs quietly assume a state, such as a large balance
Which state does the rule depend on, and is it varied?
Rule collisions
Each rule is tested alone
What happens when two rules apply at once?
Duplicate partitions
Five cases exercise the same class of input
Which cases could go without losing detection?
Invented behaviour
An expected result the requirement never states
Where in the requirement does this come from?
Silent ambiguity
The case picks one reading of an unclear rule
Is this a question for the product owner?
Invented behaviour deserves special care. A model asked to be complete will fill gaps with plausible rules. Traceability catches it: if a case names a requirement and the requirement does not support the expected result, either the case or the requirement needs a person.
A review checklist you can reuse
Before generation
Lint the requirement and replace every vague word with a number or a rule.
Fix the case format, with an ID, a requirement reference, a category, concrete inputs and an expected result.
Ask for positive, negative and boundary cases for every rule, and for an open-questions list.
During review
Run the cases against a reference, a stub or a build. Do not rely on reading.
Build the matrix. Requirements down, categories across. Empty cells are the work.
Check traceability: every case names a rule, and every rule has cases.
Add what a person would: boundaries, state and combinations of rules.
Remove duplicates that test the same rule with the same class of input.
After review
Record what the reviewer changed: added, edited, removed. It is the evidence that review happened.
Keep open questions with the suite until a person answers them.
Re-run the matrix when requirements change. It takes seconds.
Where does AI test case generation help most, and where does it not?
AI-drafted cases are strongest where the work is breadth and structure: listing input combinations, drafting negative cases from validation rules, producing consistent titles and steps and translating a requirement into the case format your team already uses.
Generation is weakest where the answer depends on knowledge the requirement does not contain: business context, past incidents, regulatory detail and the quirks of the system. That knowledge is the reviewer's contribution, which is why the role changes and does not disappear. The same pattern holds for code, as described in the guide to testing AI-generated code: drafting is quick and verification is the skilled part. If the cases will feed an automation suite, the Playwright agents guide shows where plans and generated tests need the same review, and the guide to testing AI agents covers measuring reliability when the thing under test is itself an AI system.
The same workflow for other requirement types
Requirement type
Edges to add during review
Form validation
Minimum and maximum length, empty, whitespace only, special characters, paste behaviour
API request
Missing field, wrong type, extra field, oversized payload, repeated request
Search and filters
Empty result, single result, many results, combined filters, special characters
Permissions
Each role against each action, a user whose role just changed, a deleted account
Dates and times
Month ends, leap days, time zones, daylight saving changes, past and future limits
Workflow states
Each allowed transition, each forbidden transition, a repeated transition
How do you measure AI test case quality? Mutation testing and past defects
Measure
How
Why it matters
Cases agreeing with the reference
Run them
Catches wrong expected results
Boundary cases per rule
Matrix
Catches wrong expected results
Seeded or historical defects caught
Mutation, or replay of past bugs
The only direct effectiveness measure
Review changes per draft
Diff of draft and final
Shows where the requirement or the template is weak
Open questions raised
The list
A rising count means the requirements are improving
Do not count generated cases as an achievement. A suite of 200 unreviewed cases that catches 5 of 12 defects costs more to run and maintain than 22 that catch 12, and it looks safer.
If you have no reference implementation, replay past defects: take five bugs from the last quarter and check whether the suite would have caught them. It is the most convincing evidence for a sceptical stakeholder.
How to roll this out in a team
Start with one requirement type the team writes often, such as validation rules.
Agree the case format once, so the checker and the matrix work for everyone.
Review in pairs for the first month. One person reads the draft and the other reads the matrix. The differences between what each found are the lessons.
Keep a short log of what reviewers added, grouped by the patterns above. After a month it shows which instructions to add to the template.
Measure on past bugs before you widen scope.
The log has a second use: it is the evidence that human review happened, which matters for any organisation that has to show how AI output is checked. For the broader loop of plan, generate and review, see the guide to agentic testing.
Frequently Asked Questions
How do I generate test cases from requirements with AI?
Clean the requirement so every rule has a number or a condition, give the model a structured case format, and ask for positive, negative and boundary cases per rule plus a list of open questions. Treat the output as a draft: run the cases against a reference, check the coverage matrix and add the missing cases.
Are AI-generated test cases reliable?
They are usually valid and often incomplete. In our example all 14 draft cases were correct and the draft still caught only 5 of 12 seeded defects. Published studies show the same split: generated tests often pass a reference but vary widely in fault detection. Reliability comes from review, not from the generator.
Why do AI test cases miss boundary conditions?
Requirements rarely state boundaries as separate facts, and a model writes the cases the wording makes obvious. A rule such as "at least 2 days before" yields a clear pass and a clear fail. The exact boundary needs an explicit instruction or a reviewer.
How do I review AI-generated test cases quickly?
Run them, then read a coverage matrix instead of the list. The matrix shows empty cells in seconds. Check traceability to requirements and add boundary cases wherever a rule has a threshold, a cap or an exact-match condition.
How should requirements be written for AI test generation?
State each rule with a number or an explicit condition, replace words such as "reasonable", "long" and "valid" with definitions, give every rule an identifier, close every list and write down open questions. A requirement a person can test without asking questions is one a model can use, which is also the best answer to requirements ambiguity in testing.
What is mutation testing and why use it for test cases?
Mutation testing plants small defects in the product and counts how many your tests catch. It measures whether a suite would notice a fault, which coverage percentages do not. Our example used 12 planted defects: the draft caught 5 and the reviewed suite caught 12.
Can AI replace manual test design?
AI replaces typing, not thinking. It drafts breadth quickly. A tester still decides what a rule means, which edges matter and what the draft missed, so the work moves toward requirement clarity and review.
Which tool should I use to generate test cases?
Any tool that accepts a requirement and returns structured cases can produce a draft. Choose one that gives traceable output you can export and review. Test Suite Studio produces structured scenarios from requirements, and the checks in this post work with output from any tool.
Conclusion
A draft that is entirely correct can still leave most defects uncaught. AI test case generation saves time when it is the first step of a workflow whose second step is a measured review. Clean the requirement, generate the draft, read the matrix, add the missing cases and keep a record of what you changed.
Key Takeaways
AI test case generation is a draft step, and review turns the draft into a suite. A generated test suite can be fully correct and still weak. In the worked example, 14 of 14 draft cases agreed with the rules, and the draft caught 5 of 12 seeded defects.
Fix the requirement first. Six of eight raw requirements contained wording that cannot be tested, and a lint script found them in a second.
Ask for boundaries and an open-questions list in the generation request. Models fill gaps confidently unless told where to stop.
Review with a coverage matrix. Empty cells show missing boundary cases faster than reading a list.
Eight added boundary cases moved defect detection from 5 of 12 to 12 of 12. Ask for the right cases, not more cases.
Run cases against a reference or a build. Published research reports that execution feedback is what makes generated tests valid.
Measure effectiveness by defects caught, not by case count. Replay past bugs if you have no reference.
Keep open questions with the suite until a person answers them.
The draft in this post is illustrative, not a recorded model run. Every check and number is real.
Happy Testing!
AI Test Case GenerationTest DesignRequirementsTest ReviewBoundary TestingMutation TestingAI in QA
Hely PatelHead of Product and Marketing @AIdriventesting.ai. Leads the platform's AI testing tools from idea to launch, and writes about AI-driven testing and practical AI adoption for QA teams.