💻 Coding

Test Case Generator: User Story to Edge Cases and Gherkin

Turn a user story and acceptance criteria into a test case table: positive, negative, boundary, and edge cases, test data, priorities, and Gherkin scenarios.

0.0
0Reviews
P
October 10, 2026

Prompt

Act as a senior QA engineer and test analyst who designs test cases from requirements using equivalence partitioning, boundary value analysis, and state transitions, and who flags gaps in the requirements instead of guessing.

Inputs:
- User story: [UserStory]
- Acceptance criteria, numbered: [AcceptanceCriteria]
- Business rules, limits, and validation rules: [BusinessRules]
- Roles and permissions involved: [UserRoles]
- Platforms or environments in scope (web, iOS, Android, API): [TestEnvironments]
- Test case format my team uses (table columns or tool import format): [CaseFormat]

Generate:
1. Requirement gaps: questions about anything in AcceptanceCriteria or BusinessRules that is ambiguous or missing, each with the test cases blocked by it.
2. A test condition list: each condition traced to an acceptance criterion number.
3. Equivalence partitions and boundary values for every input field or limit in BusinessRules, shown as valid and invalid classes with the exact boundary values to test.
4. Test cases in CaseFormat: ID, title, linked criterion, preconditions, steps, test data, expected result, priority (P1 to P3), and type (positive, negative, boundary, edge, permission).
5. Permission cases: what each role in UserRoles can and cannot do, one case per denied action.
6. Gherkin scenarios (Given, When, Then) for the P1 cases, using a Scenario Outline with an Examples table where data varies.
7. A short coverage summary: criteria covered, cases per type, and which TestEnvironments each P1 case must run on.

Rules:
- Every case traces to an acceptance criterion or a listed business rule. Do not invent features.
- Expected results state observable behavior, not "works correctly".
- Write unclear expected results as [CONFIRM WITH PO].

Instructions

Replace every [bracket] with the real user story, acceptance criteria, and business rules. Works on ChatGPT, Claude, and Gemini. Review the cases with your team before adding them to your test management tool.

Generated Output

This image was generated using the prompt above.

Test Case Generator: User Story to Edge Cases and Gherkin - Result

Examples

Example Input

UserStory: As a shopper, I want to apply a promo code at checkout so that I get a discount on my order.
AcceptanceCriteria: 1. A valid code reduces the order subtotal by its discount. 2. Invalid or expired codes show an error and do not change the total. 3. Only one code per order. 4. The discount shows as a separate line in the order summary.
BusinessRules: Codes are 6 to 12 alphanumeric characters, not case sensitive. Percentage codes range 5% to 50%. Minimum order subtotal $25 for any code. Codes expire at 23:59 store time on their end date.
UserRoles: Guest shopper, logged in shopper, store admin (creates codes).
TestEnvironments: Web checkout (Chrome, Safari), iOS app.
CaseFormat: table with ID, Title, AC, Preconditions, Steps, Data, Expected, Priority, Type

Example Output

1. REQUIREMENT GAPS
- Is the $25 minimum checked before or after the discount? Blocks TC-07, TC-08.
- What happens if items are removed after a code is applied and the subtotal drops below $25? Blocks TC-12.
- Does "store time" mean the store's time zone for shoppers in other zones? Blocks TC-10.

2. TEST CONDITIONS
C1 valid code applies (AC1). C2 invalid code rejected (AC2). C3 expired code rejected (AC2). C4 second code blocked (AC3). C5 discount line shown (AC4). C6 format rules (BR). C7 minimum subtotal (BR).

3. PARTITIONS AND BOUNDARIES
Code length: invalid 5, valid 6, valid 12, invalid 13.
Characters: valid alphanumeric; invalid with space or symbol (SAVE-10).
Case: SAVE10 and save10 both valid.
Subtotal: invalid $24.99, valid $25.00, valid $25.01.
Expiry: valid at 23:59 on end date, invalid at 00:00 next day.

4. TEST CASES
| ID | Title | AC | Preconditions | Steps | Data | Expected | Priority | Type |
| TC-01 | Apply valid 10% code | 1,4 | Cart subtotal $80 | Enter code, tap Apply | SAVE10 | Subtotal shows $80.00, discount line -$8.00, total updates | P1 | Positive |
| TC-02 | Lowercase code accepted | 1 | Cart $80 | Enter code | save10 | Same as TC-01 | P2 | Positive |
| TC-03 | Invalid code rejected | 2 | Cart $80 | Enter code | NOPE99 | Error message shown, total stays $80.00 | P1 | Negative |
| TC-04 | Expired code rejected | 2 | Code end date yesterday | Enter code | SPRING20 | Error shown, total unchanged | P1 | Negative |
| TC-05 | Second code blocked | 3 | SAVE10 applied | Enter second code | FALL15 | Message that only one code is allowed, first code remains | P1 | Negative |
| TC-06 | 5 character code | BR | Cart $80 | Enter code | AB123 | Error shown | P2 | Boundary |
| TC-07 | Subtotal $24.99 | BR | Cart $24.99 | Enter code | SAVE10 | Error about minimum [CONFIRM WITH PO wording] | P1 | Boundary |
| TC-08 | Subtotal $25.00 | BR | Cart $25.00 | Enter code | SAVE10 | Discount -$2.50 applied | P1 | Boundary |
| TC-09 | Code with symbol | BR | Cart $80 | Enter code | SAVE-10 | Error shown | P3 | Negative |
| TC-10 | Expiry at 23:59 | 2 | End date today, store clock 23:59 | Apply | SPRING20 | Discount applied | P2 | Edge |
| TC-11 | Guest can apply code | 1 | Guest session | Apply | SAVE10 | Same as TC-01 | P2 | Permission |
| TC-12 | Remove items below minimum | BR | SAVE10 applied, cart $30 | Remove $10 item | n/a | [CONFIRM WITH PO] | P2 | Edge |

5. PERMISSION CASES
Shoppers cannot create or edit codes: TC-13, shopper account opens admin promo URL, access denied.

6. GHERKIN (P1)
Scenario Outline: Promo code result
  Given my cart subtotal is <subtotal>
  When I apply the promo code "<code>"
  Then I see <result>
  Examples:
  | subtotal | code | result |
  | $80.00 | SAVE10 | a discount line of -$8.00 |
  | $80.00 | NOPE99 | an error and a total of $80.00 |
  | $24.99 | SAVE10 | a minimum order error |

7. COVERAGE
All 4 criteria covered. 3 positive, 4 negative, 3 boundary, 2 edge, 2 permission. P1 cases run on Chrome, Safari, and iOS.

Reviews (0)

Please login to leave a review.
Loading reviews...