Turn a User Story Into Test Cases — Prompt It Like an Engineer
Interviewers now ask, straight out, how you use AI. Good news — the honest answer starts with something you already do every day: designing test cases.
The idea, in one line
An AI can turn a user story into twenty draft test cases in seconds — but only if you tell it exactly what you want. Ask it like an engineer, not like a search box.
What a strong prompt gives the model
A weak prompt like write test cases for login returns generic, shallow output. A strong prompt hands the model four things:
- A role — "You are a senior QA engineer." This sets the standard you want.
- The story and its acceptance criteria, copied in word for word.
- The output format — for example, a table with id, title, steps, and expected result.
- The exact angles to cover — happy path, boundaries, negatives, security, and localization (different languages, alphabets, and text directions).
See it work
You are a senior QA engineer. Generate test cases for this user story.
STORY:
As a returning user, I can reset my password from the login page
by requesting a reset link sent to my registered email.
ACCEPTANCE CRITERIA:
- Reset link expires after 30 minutes
- Reset link is single-use
- Unknown email shows the same generic message (no account leak)
OUTPUT: a table of id | title | preconditions | steps | expected.
COVER EXPLICITLY: happy path, boundary (expiry at 29 / 30 / 31 min),
negative (reused link, tampered token), security (email enumeration),
localization (non-ASCII email).
Ask me a question about anything the story leaves ambiguous.Read it top to bottom: you gave the model a role, pasted the real story and rules, said how you want the answer laid out, and then listed the angles by name. Naming the angles is what pulls the model past the easy happy-path cases it reaches for by default.
Advanced — what the research actually found
In a Thoughtworks study, well-written prompts gave big speed gains and produced consistent results. But the model still leaned on a surface-level reading of the story. It wrote the obvious cases well and skipped the deeper ones unless it was told to cover them by name.
So the lesson is balanced, not hype: AI is a fast first-draft machine. The judgment about which angles matter still comes from you.
Grounded in Thoughtworks' experimental study 'AI-generated test cases from user stories'
All lessons in AI-Augmented QA & Modern Tooling
- Turn a User Story Into Test Cases — Prompt It Like an Engineer
- Critique and Prune — Where AI-Generated Tests Go Blind
- AI Coding Assistants — What to Hand Off, What to Review
- Self-Healing Locators — and the False-Pass Risk
- Ship an AI-in-the-Loop Suite Through CI — and Tell the Story