Skip to main content
Generating Test Cases from Requirements with AI

AI-Assisted Test Case Design

Generating Test Cases from Requirements with AI

Reading10 min read

Generating Test Cases from Requirements with AI

Writing a complete set of test cases from a user story or acceptance criteria is repetitive, detail-heavy work — exactly the kind of task where an AI assistant earns its keep. Used well, it does not replace your test design skill; it removes the blank-page problem and gives you a first draft to sharpen.

Why This Works

Large language models are pattern-completion engines. Given a requirement and a clear instruction about what a "test case" looks like, they can enumerate positive paths, negative paths, and obvious edge cases far faster than you can type them. What they cannot do reliably is know your system's specific quirks, your team's risk appetite, or which edge cases actually matter in production — that judgment stays with you.

A Prompt Template That Works

You are a senior QA engineer. Generate test cases for the following
user story. For each test case include: ID, title, preconditions,
steps, expected result, and priority (High/Medium/Low).

Cover: happy path, negative/invalid input, boundary values, and at
least one permission/authorization scenario if relevant.

User story:
"As a registered user, I want to reset my password via email so that
I can regain access to my account if I forget my credentials."

Notice what the prompt does: it names the persona, defines the exact output structure, and explicitly asks for categories of coverage instead of leaving it to chance. Vague prompts ("write some test cases for this") produce vague, shallow output.

What Good Output Looks Like

Test CaseCategoryPriority
Valid email receives reset link within 60sHappy pathHigh
Unregistered email shows generic "if this email exists" messageNegative / securityHigh
Reset link expires after configured TTLBoundaryMedium
Reset link can only be used onceNegativeHigh
Password reset while old session is active on another deviceEdge caseMedium

That last row is the kind of scenario a rushed human draft often misses — and it's exactly the kind of lateral edge case a well-prompted AI assistant surfaces reliably, because it isn't anchored to "the happy path I was picturing" the way a person mid-sprint often is.

The Non-Negotiable Review Step

Every AI-generated test case is a draft, not a deliverable. Before it goes into your test management tool, check it against three questions: Is this technically accurate for our system? Is the priority realistic given our actual risk? Did it invent a requirement that isn't actually true? Treat AI output the way you'd treat a draft from a very fast, very literal junior tester — useful, prolific, and in need of your domain judgment before it ships.

💬 Discussion

Pick a real user story from your current backlog. What test cases would you expect an AI assistant to generate correctly, and which ones do you think it would miss because they depend on knowledge specific to your system?

Q
Knowledge Check
1 / 3

Why does giving an AI assistant an explicit output structure (ID, title, preconditions, steps, expected result, priority) produce better test cases than a vague prompt?

Next Lesson

Using AI for Edge-Case and Boundary Discovery