Modern QA2026Putting It All Together: A Complete Prompt
Log inJoin
1 / 3 · Book 2 · The Anatomy of a Test-Generation Prompt · drill: interview Q&A⊞ allnext →Get the book →

1.8Putting It All Together: A Complete Prompt

Here is a complete prompt that includes all five elements:

You are a senior QA engineer. Given the following user story, acceptance criteria,
and technical context, generate a comprehensive test suite.

**User Story:**
As a customer, I want to apply a coupon code during checkout so that I get
a discount on my order.

**Acceptance Criteria:**
1. Valid coupon codes reduce the order total by the specified percentage
2. Expired coupons return a clear error message
3. Coupons can only be used once per customer
4. Invalid coupon format is rejected before hitting the database

**Technical Context:**
- Backend: Node.js 20, Express 4, TypeScript
- Database: PostgreSQL 15 via Prisma ORM
- Test framework: Vitest + Supertest
- Auth: JWT tokens via get_test_token("customer") helper
- Coupon format: 8 uppercase alphanumeric characters (regex: ^[A-Z0-9]{8}$)

**Generate:**
1. Unit tests for coupon validation logic (no DB, no HTTP)
2. Integration tests for the POST /api/v2/checkout endpoint with coupon
3. Edge case tests (empty string coupon, SQL injection in coupon field, etc.)

**For each test, include:**
- Test name: "should [expected behavior] when [condition]"
- Arrange/Act/Assert structure with comments
- Explicit assertions (not just "expect something")

**Coverage requirements:**
- All 4 acceptance criteria must have at least one test
- At least 2 negative/error cases per AC
- Boundary test for coupon format (7 chars, 8 chars, 9 chars)

This prompt contains all five elements:

  1. Context: Node.js 20, Express 4, TypeScript, PostgreSQL, Prisma
  2. Artifact: User story with 4 acceptance criteria
  3. Constraints: Vitest + Supertest, AAA pattern, naming convention
  4. Coverage goals: All ACs, 2 negatives per AC, boundary tests
  5. Output format: Test name pattern, AAA structure, explicit assertions