Skip to content

Generate Test Cases from Requirements with AI

Test DesignUpdated 2026-10-21intermediate
TL;DR

Given one requirement, the model returns a structured suite of 8-10 test cases, ID, title, preconditions, steps, expected result, priority, and the design technique that generated each case, covering happy path, negative scenarios, boundary values, equivalence partitions, and edge cases.

When to use it

  • You have a written requirement or acceptance criterion and need a first-pass test suite.
  • You want consistent coverage of negative and boundary scenarios that humans tend to skip.
  • You're onboarding a new tester and need a reference for ISTQB-style technique application.
  • You're auditing existing test coverage against a requirement to find gaps.

The prompt

XML-tagged: works best with Claude
generate-test-cases-from-requirements.claude.mdprompt
<role>You are a senior test designer with ISTQB Advanced certification. You apply equivalence partitioning, boundary value analysis, and edge case identification with discipline.</role> <context>The team writes test cases in a structured Markdown table format. Every test case must cite the design technique that produced it so reviewers can verify coverage. Cases are prioritized P1 (must), P2 (should), P3 (could).</context> <task>From the requirement I provide, generate 8-10 test cases covering:- Happy path (positive scenarios)- Negative scenarios (invalid inputs, unauthorized access, etc.)- Boundary values (just inside / on / just outside each numeric or length boundary)- Equivalence partitions (one case per valid and invalid class)- Edge cases (Unicode, null, empty, max length, simultaneity) At least 30% of cases must be non-happy-path.</task> <input>Requirement: {requirement}Additional constraints (optional): {constraints}</input> <constraints>- 8-10 cases, unless Additional constraints set a different count.- Each case has columns: ID, Title, Preconditions, Steps, Expected Result, Priority (P1/P2/P3), Technique (EP / BVA / Edge / Negative / Happy).- Steps numbered 1, 2, 3: no narrative. Inside table cells, separate steps with <br> so the table stays valid Markdown.- Expected Result is observable and atomic: no "system behaves correctly".- Do not invent fields not present in the requirement.</constraints> <output_format>A Markdown table with the 7 columns above, followed by a 2-3 sentence "Coverage notes" paragraph explaining which equivalence classes were covered and which weren't (and why).</output_format> <approach>Before writing the table, identify the equivalence classes and boundaries.</approach>

Example

Input
Requirement: A user can sign up by providing email, password, and age. Email must be valid format and unique. Password must be 8-64 characters with at least one number. Age must be 18 or older.
Output
| ID    | Title                                | Preconditions | Steps | Expected Result | Priority | Technique |
|-------|--------------------------------------|---------------|-------|-----------------|----------|-----------|
| TC-01 | Valid signup with all fields correct | No account with given email | 1. POST /signup with email "a@b.com", password "Pass1234", age 25<br>2. Read response | 201 Created, response contains user id | P1 | Happy |
| TC-02 | Email already registered             | Existing user "a@b.com" | 1. POST /signup with email "a@b.com", password "Pass1234", age 25 | 409 Conflict with code EMAIL_TAKEN | P1 | Negative |
| TC-03 | Email missing @ symbol               | None | 1. POST /signup with email "ab.com", password "Pass1234", age 25 | 400 Bad Request with field error on email | P1 | EP (invalid email class) |
| TC-04 | Password exactly 8 characters        | None | 1. POST /signup with email "b@b.com", password "Pass1234" (8 chars), age 25 | 201 Created | P2 | BVA (lower boundary, on) |
| TC-05 | Password 7 characters                | None | 1. POST /signup with email "c@b.com", password "Pass123" (7 chars), age 25 | 400 Bad Request, password too short | P1 | BVA (lower boundary, just outside) |
| TC-06 | Password exactly 64 characters       | None | 1. POST /signup with email "d@b.com", password = 63 random chars + "1" (64 chars), age 25 | 201 Created | P2 | BVA (upper boundary, on) |
| TC-07 | Password 65 characters               | None | 1. POST /signup with email "e@b.com", password = 64 random chars + "1" (65 chars), age 25 | 400 Bad Request, password too long | P2 | BVA (upper boundary, just outside) |
| TC-08 | Password without any number          | None | 1. POST /signup with email "f@b.com", password "Password", age 25 | 400 Bad Request, password needs a number | P1 | EP (invalid password class) |
| TC-09 | Age exactly 18                       | None | 1. POST /signup with email "g@b.com", password "Pass1234", age 18 | 201 Created | P2 | BVA (lower boundary, on) |
| TC-10 | Age 17                               | None | 1. POST /signup with email "h@b.com", password "Pass1234", age 17 | 400 Bad Request, must be 18+ | P1 | BVA (lower boundary, just outside) |

Coverage notes: All three numeric/length boundaries are exercised on-boundary and just-outside, password lower 8 (TC-04 / TC-05), password upper 64 (TC-06 / TC-07), age lower 18 (TC-09 / TC-10). The "valid email" equivalence class is hit positively by TC-01, the "invalid email" class by TC-03, the "duplicate email" rule by TC-02. Not covered in this batch, because the 8-10 case cap forces a choice: edge cases (Unicode local-part per RFC 6531, empty body, concurrent signups with the same email), SQL/XSS injection in password (security testing), rate limiting, and password complexity beyond the documented "at least one number". Run those as a second pass scoped to edge cases.

Common pitfalls

  • Model defaults to mostly happy-path cases; the 30% non-happy-path constraint is essential.
  • Boundary values often come out as 'representative' rather than literal on/just-outside boundaries: review explicitly.
  • Without the technique column, you can't tell whether coverage is broad or shallow.
  • Model may invent fields (e.g., 'username') not present in the requirement: keep the don't-invent constraint.

Tips

  • Paste the requirement verbatim, not your summary of it: phrasing matters for what constraints the model picks up.
  • If the requirement has 4+ fields, put "12-15 cases" in Additional constraints to keep boundary coverage complete.
  • Pair this prompt with `boundary-equivalence-generator` when the requirement has many numeric fields: that prompt goes deeper on BVA.
  • For acceptance criteria from a story, run `create-bdd-scenarios` instead: Gherkin output is closer to the user's domain language.

FAQ

How is this different from `create-bdd-scenarios`?

This prompt produces test cases in a tabular ISTQB-style format optimized for test management tools (Zephyr, TestRail, qTest). BDD scenarios are written in Gherkin and live next to step definitions in a code repo. Use this for test-management workflows; use BDD when tests live in code.

How do I scale to 50 cases without losing quality?

Run the prompt iteratively, each time scoping to one equivalence class or technique: e.g., 'now generate only boundary cases for the upload size limit'. Stitching together batched output gives consistent quality where one mega-prompt loses focus.

Can it derive cases from acceptance criteria written in Gherkin?

Yes: paste the Given/When/Then scenarios as the requirement. The model will produce table-form cases and is good at expanding negative paths the Gherkin omitted.

Why limit to 8-10 cases?

Beyond ~10 cases the model loses discipline and starts duplicating equivalence classes. Multiple smaller runs produce better total coverage than one large one.

Use with these tools