Modern QA2026Exercises
Log inJoin
12 / 14 · Book 2 · The Anatomy of a Test-Generation Prompt← prev⊞ allnext →Get the book →

1.12Exercises

Exercise 1.1 (Beginner): Take a feature you recently tested at work. Write a test-generation prompt that includes all five elements. Do not run it yet -- just write the prompt. Score yourself: does it include Context? Artifact? Constraints? Coverage Goals? Output Format?

Exercise 1.2 (Beginner): Compare these two prompts. List every problem with Prompt A and identify which element is missing or weak:

Prompt A: "Write tests for user registration."

Prompt B: "Generate pytest tests for the POST /api/v1/users endpoint. The endpoint accepts {email, password, name} with email requiring valid format, password minimum 8 characters with at least one digit. Use the existing test pattern from test_auth.py. Include tests for valid registration, duplicate email, short password, invalid email format, and missing required fields."

Exercise 1.3 (Intermediate): Find an OpenAPI schema (your project's or a public one like Petstore). Extract one endpoint and write a complete five-element prompt for it. Feed it to an AI tool and evaluate the output: how many tests were generated? How many are immediately usable? What would you change in the prompt?

Exercise 1.4 (Advanced): Using the prompt iteration loop, refine a prompt through 3 iterations. Document each iteration: what was wrong, what you changed, and how the output improved. Save the final prompt as a template.