Problem
Writing test cases from user stories is slow and uneven. One tester writes fifteen cases with boundaries, another writes four happy paths, and nobody can quickly show which acceptance criterion each test covers. Asking a chatbot for tests is faster but creates new risks: invented requirements, missing negative and boundary cases, and output nobody has checked.
Approach
I built the generator in n8n as a quality-controlled pipeline, not a single prompt:
- Three entry points, one pipeline. A story arrives from Jira (label
ai-test-gen, picked up every 10 minutes), a web form (Jira key or pasted story), or a REST API for CI. Each is normalized into one shape, with acceptance criteria numberedAC1…ACnfor traceability. - Claude Opus 5.5 with structured outputs. A senior-QA system prompt requires boundary tests for every limit, negative tests for invalid input, one behaviour per test and exact expected values. A JSON schema makes the API guarantee the response structure.
- A quality gate written in code. Before anything is saved or posted, the workflow verifies that every criterion has a test, that no given criterion was dropped, that there are no broken references or duplicates, and that at least one negative test exists. The model proposes; the code verifies.
- Refusing to guess. Stories with nothing testable return
needs_clarificationwith specific questions for the product owner. Non-stories and prompt-injection attempts are declined. - Outputs for every audience. A Jira comment with a traceability table and full steps, plus a label so no story is processed twice. A Postgres test library with a requirement-to-test traceability matrix and quality and cost tracking. A results page for testers, and JSON plus CSV for Xray, Zephyr or TestRail.

Result
- 14–16 test cases per story in about 40 seconds, with 100% acceptance-criteria coverage verified by the quality gate, on the end-to-end tests I ran (via the API and the web form).
- On the instant-withdrawal-fee story, Claude found the real boundaries (a $16.00 withdrawal hits the $0.25 minimum fee, a $1,000 withdrawal hits the $15 maximum) and raised five questions the story left open, such as rounding of half cents.
- 4 of 4 out-of-scope inputs declined correctly, including a prompt-injection attempt, and the story without listed criteria passed with all expected facts covered.
- About $0.10 per story on Claude Opus 5.5, and about $0.003 on Claude Haiku 5.5. Token usage is tracked per run in the database.
- Ships with a 21-case evaluation suite with quality gates (≥ 85% in-scope pass rate, 100% correct refusals), a node-by-node build guide, and 16 sample stories for a fictional digital wallet.
What this shows
Test automation and AI assurance in one workflow: requirements traceability, boundary and negative test design, deterministic checks on model output, and an evaluation suite that turns "the AI wrote some tests" into a measurable, repeatable process.