Modern QA2026Element 5: Output Format
Log inJoin
7 / 14 · Book 2 · The Anatomy of a Test-Generation Prompt← prev⊞ allnext →Get the book →

1.7Element 5: Output Format

Controlling the output format makes the generated code immediately usable rather than requiring reformatting.

Format specifications:

**Output format:**
- One describe block per endpoint
- One it block per test case
- Group related tests with nested describe blocks
- Include JSDoc comment above each test explaining what it verifies
- Output as a single TypeScript file ready to save to tests/
- Tests should be ordered: happy path first, then errors, then edge cases
- Use consistent indentation (2 spaces)
- Include all necessary imports at the top of the file

Format for different outputs:

When you want code:

Output as a single Python file with pytest fixtures at the top.

When you want a test plan:

Output as a numbered markdown table with columns:
Test ID, Scenario, Input, Expected Result, Priority, Type (unit/integration/e2e)

When you want BVA analysis:

Output as a markdown table with columns:
Field, Input Value, Expected (accept/reject), Rationale

Common Mistake: Not specifying the output format and getting a mix of explanation text and code blocks that requires manual extraction. Always tell the AI exactly what shape you want the output in.