Skip to main content

Claude/ChatGPT Prompt to Turn a User Story into Acceptance Tests

Turn a product user story into precise Given/When/Then acceptance criteria plus ready-to-fill test stubs in your framework, covering roles and business rules.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt

                                

What this prompt does

This prompt turns the model into a senior engineer who pairs with QA, translating a product [user_story] into precise, testable behavior plus real test stubs in [test_framework]. You supply the story, the framework, the [roles] in play, and the known [rules], and it returns numbered Given/When/Then acceptance criteria followed by a copy-ready test skeleton.

What makes it useful is the breadth it forces. Beyond the happy path, it demands permission edge cases per role, validation-failure scenarios for each business rule, at least one concurrency scenario where two actors collide, and one negative test per rule. The [roles] variable drives the permission scenarios and [rules] drives the validation and negative tests, so the coverage scales with the real complexity of your feature rather than the obvious cases.

The value of doing this before estimating is that it makes "done" concrete. A story stays contested until the criteria are written down, and the scenarios that catch real bugs are the permission and concurrency ones people forget to spec. By generating the test skeleton in the same pass, the prompt closes the gap between agreeing on behavior and verifying it, so the criteria are not just documentation but a structure your implementation has to satisfy. The instruction to return real stubs rather than a description of testing is deliberate, since prose about coverage rarely survives contact with the codebase.

When to use it

  • "Done" for a feature is contested until the criteria are written down.
  • You want acceptance criteria before estimating, not after a bug report.
  • A feature has multiple [roles] whose permissions need explicit scenarios.
  • Business [rules] like limits or uniqueness need validation and negative tests.
  • Concurrency matters and you want a collision scenario specced upfront.
  • You want test stubs in [test_framework] ready to fill, not a prose description.

Example output

Expect two blocks. First, numbered Given/When/Then acceptance criteria: the happy path, then per-role permission scenarios from [roles], validation failures for each of the [rules], a concurrency collision, and negative tests. Second, a test file skeleton in [test_framework] with descriptive test names, empty bodies, and the intended assertions described in comments, ready to drop into the project and implement.

Pro tips

  • Write the [user_story] in real product language; vague stories yield vague criteria.
  • List every relevant role in [roles], since each one becomes its own permission scenario and missing roles mean missing coverage.
  • State all enforceable [rules] explicitly so validation and negative tests get generated for each.
  • Match [test_framework] to your actual stack so the skeleton is copy-ready, not pseudo-code you must port.
  • Implement the negative and concurrency tests first; they expose assumptions hiding in the happy path.
  • Use the comments in the stubs as a spec, filling assertions before adding implementation.

Frequently Asked Questions

Does it write actual test code or just describe testing?
It returns a real test file skeleton in `[test_framework]` with descriptive names, empty bodies, and intended assertions written as comments. The bodies are left for you to fill, but the structure and naming are copy-ready rather than a prose description of what to test.
Will it cover more than the happy path?
Yes, that is the point. It generates permission scenarios for every role in `[roles]`, validation failures for each of the `[rules]`, at least one concurrency collision, and a negative test per rule. These edge cases are where real bugs tend to hide.
Can I use it with my own test framework?
Yes. The `[test_framework]` variable controls the language and structure of the generated skeleton, so you get stubs that match your stack. Pick the framework you actually deploy with so the output drops straight into your project.
Why does it ask for business rules separately from the story?
Because the `[rules]` drive the validation-failure and negative-test scenarios that a plain story often omits. Stating limits, uniqueness constraints, or caps explicitly ensures each gets its own scenario rather than being assumed in the happy path.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in ChatGPT Prompts for Developers

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support