What Is the Minimum Viable Context for Generating Good Manual Test Cases?
The quality of AI-generated test cases is a direct function of the quality of the context you provide. This is not a cliche — it's a testable hypothesis. Run the same feature through a poorly-contextualized prompt and a well-contextualized one; the output quality difference will be dramatic. The practical question is: what is the minimum viable context to get genuinely useful test cases, and what additional context produces the most marginal improvement?
The Context Hierarchy
Not all context is equal. Ranked by impact on test case quality:
| Rank | Context element | Why it matters |
|---|---|---|
| 1 | Acceptance criteria | Defines what "done" looks like — without AC, the AI infers behavior from generic patterns |
| 2 | User story with goal statement | Tells the AI who is doing what and why, enabling scenario variety |
| 3 | User roles and permissions | Enables permission-based test scenarios, the most commonly missed category |
| 4 | Data model / field constraints | Enables accurate boundary and validation tests |
| 5 | Integration points | Enables error path and dependency failure tests |
| 6 | UI/design spec or wireframe description | Enables UI-state and flow-based tests |
| 7 | Existing test cases (as style guide) | Aligns format and granularity to your team's conventions |
What "Minimum Viable" Looks Like
For a basic feature, the minimum viable context is: user story + acceptance criteria + user roles. With only these three, you can get reasonable happy-path and basic negative-path coverage.
Minimum viable prompt:
Generate manual test cases for the following feature.
User Story: As a [role], I want to [action] so that [benefit].
Acceptance Criteria:
- AC1: [AC text]
- AC2: [AC text]
- ...
User roles with access to this feature:
- [Role 1]: [What they can do]
- [Role 2]: [What they can do]
Output format per test case:
ID | Title | Role | Preconditions | Steps | Expected Result | Category (Positive/Negative/Edge)
This minimum baseline will produce usable output for simple CRUD features. For anything involving complex validation logic, multi-step flows, integrations, or permission hierarchies, you need to move up the context hierarchy.
The Most Impactful Context Addition: Field-Level Constraints
Adding data model constraints — specifically field-level validation rules — produces the single largest jump in negative-path test quality. Without this, the AI writes generic negative tests ("enter an invalid email"). With it, the AI writes precise ones ("enter an email longer than 254 characters," "enter an email with two consecutive dots in the domain").
Prompt:
Generate test cases with particular focus on input validation. Use the following field constraints to generate specific boundary and negative test cases for each field.
Field Constraints:
- email: required, max 254 chars, must match RFC 5322 format, must be unique in system
- username: required, 3–30 chars, alphanumeric and underscores only, case-insensitive uniqueness
- age: required, integer, min 13, max 120
- bio: optional, max 500 chars, HTML stripped on save
For each constraint, generate: at-boundary valid, just-over-boundary invalid, empty/missing, and format-invalid scenarios.
The Diminishing Returns Boundary
More context isn't always better. Beyond a certain point, you're adding noise that dilutes the AI's focus. Context that typically hurts more than it helps:
- Long implementation-detail docs describing how the backend works internally (the AI starts writing tests for implementation instead of behavior)
- Full codebase dumps without specific focus guidance
- Unrelated feature documentation that wasn't narrowed down before pasting
- Contradictory requirements from different sources without disambiguation
Pruning and curating your context before pasting is as important as what you include.
Learning Tip: Build a context checklist for your sprint ceremonies. Before a sprint starts, for each story going into QA, run down: "Do I have AC? Do I know the user roles? Do I have field constraints? Do I know what APIs or services this touches?" Anything missing is a conversation to have with the product or dev team before the feature lands in testing — not after. Incomplete context at prompt time usually means incomplete requirements that will cause rework anyway.
How to Include Design Specs, Wireframes, and User Flow Diagrams as AI Context?
Design specs and wireframes contain test-relevant information that isn't captured in user stories: exact field labels, form layouts, conditional UI states, loading indicators, error message copy, and state transitions. Knowing how to convert these into AI-readable context is a significant force multiplier.
Translating Wireframes into Text Context
If you're using a vision-capable AI (Claude, GPT-4V, Gemini), you can attach images directly. If you're using a text-only model or prefer to keep context reusable, translate wireframes into a structured text description.
Wireframe-to-text translation prompt:
I have a wireframe for a [feature name] screen. Describe the wireframe in a structured format that a QA engineer can use to generate test cases. Include:
1. Screen name and purpose
2. All input fields (label, type, required/optional, any visible constraints)
3. All interactive elements (buttons, links, toggles, dropdowns — label and action)
4. Conditional sections (what conditions make them appear/disappear)
5. Error states visible in the wireframe
6. Navigation paths from this screen
If you have a vision-capable model, append the wireframe image and use:
Prompt (vision model):
[Attach wireframe image]
This is a wireframe for [feature name]. Analyze the wireframe and extract all testable UI elements:
- Input fields with their labels and any visible validation hints
- Interactive controls and their expected behaviors
- Conditional UI states (elements that appear/disappear based on user action)
- Error and empty states shown in the wireframe
- Navigation actions (buttons that change screens or states)
Output a structured list I can use as context for generating test cases.
Using Figma Design Specs
Figma exports structured design specs that describe component states, spacing, typography, and interaction flows. The most relevant parts for test case generation are:
- Component variants — Each variant (default, hover, disabled, error, success) is a potential test state
- Auto-layout or conditional visibility rules — These describe what conditions show or hide elements
- Prototype flow links — These describe the expected navigation path (and implicitly, what should happen on each interaction)
- Copy/content specs — Exact error message text, label text, and placeholder text you need to verify
Prompt for Figma spec context:
I'm extracting test cases from a Figma design spec. Here is the component/screen spec description:
[PASTE FIGMA SPEC OR DESCRIBE COMPONENT VARIANTS]
From this, generate test cases that cover:
1. Each component state (default, hover, disabled, error, loading, success) — verify correct visual state is rendered
2. Each conditional visibility rule — verify element shows/hides under the correct conditions
3. Each interactive transition — verify correct destination state is reached
4. Content accuracy — verify all displayed text matches spec copy
5. Accessibility-observable properties — verify alt text, ARIA labels, focus order where visible in spec
User Flow Diagrams as Test Coverage Maps
A user flow diagram is essentially a visual test coverage map — every decision node is a branch to test, every path through the diagram is a scenario. Use the flow structure explicitly in your prompt:
Prompt:
I have a user flow diagram for [feature name]. The flow has the following paths:
[DESCRIBE FLOW PATHS, e.g.:]
- Start → Login screen → [Success] → Dashboard
- Start → Login screen → [Wrong password] → Error state → Retry
- Start → Login screen → [Forgot password] → Reset flow
- Start → Login screen → [Account locked] → Locked state screen
- Dashboard → [Session expires] → Redirect to login with return URL
Generate test cases for:
1. Each path through the flow (one test case per distinct path)
2. Each decision point with all outcomes (both success and failure branches)
3. Dead-end or terminal states (locked, error, timeout) — verify recovery or re-entry is possible
For each test case, reference the flow path it exercises (e.g., "Path: Login → Wrong password → Retry → Success").
Combining Design Spec with AC in One Prompt
The most powerful approach is to combine AC and design spec context so the AI can generate tests that validate both functional and UI correctness in one pass:
Prompt:
Generate test cases that validate both functional behavior (from AC) and UI correctness (from design spec).
Acceptance Criteria:
[PASTE AC]
Design Spec Summary:
[PASTE DESIGN SPEC OR WIREFRAME DESCRIPTION]
For each test case, specify:
- Whether it primarily validates functional behavior, UI state, or both
- The specific UI element or functional outcome being asserted
- The exact expected text, state, or behavior (reference the design spec where specific copy or state is defined)
Learning Tip: The most commonly missed test cases in any feature are the conditional UI states — the "loading" state, the "empty state" (when there's no data to show), and the "error state" after a failed operation. These are almost always defined in the design spec but often absent from the AC. Make a habit of scanning the design spec for these states before generating test cases. Add them explicitly to your prompt if they aren't captured in the AC, or they'll likely be missing from the AI output.
How to Use Existing Test Cases as Style Examples to Guide AI Output Format?
Consistency in test case format is not a bureaucratic concern — it's a practical one. Inconsistent formats slow down test execution (testers have to re-orient to each test's structure), make QA reporting harder, and complicate importing into test management tools. When generating tests with AI, the easiest way to enforce your team's format is to show the AI exactly what you want by example.
The Few-Shot Prompting Technique for Test Format
Few-shot prompting means showing the AI a few examples of the output you want before asking it to generate new output. The examples act as a template the AI reverse-engineers and applies to the new input. For test case format, this is highly effective.
Prompt structure:
Generate test cases for the feature below. Use the same format and level of detail as the example test cases provided.
## Example Test Cases (use as format reference):
**TC-001**
Title: Successful login with valid email and password
Preconditions: User account exists and is active. User is on the login screen.
Steps:
1. Enter a valid registered email address in the Email field
2. Enter the correct password in the Password field
3. Click the "Log In" button
Expected Result: User is redirected to the Dashboard. The navigation bar displays the user's first name. The URL changes to /dashboard.
Category: Positive
Priority: Critical
AC Reference: AC-01
**TC-002**
Title: Login fails with incorrect password
Preconditions: User account exists and is active. User is on the login screen.
Steps:
1. Enter a valid registered email address in the Email field
2. Enter an incorrect password in the Password field
3. Click the "Log In" button
Expected Result: Login does not proceed. An error message "Incorrect email or password" is displayed below the form. The password field is cleared. The email field retains the entered value.
Category: Negative
Priority: High
AC Reference: AC-03
## New Feature to Test:
[PASTE NEW FEATURE DESCRIPTION AND AC]
Calibrating Granularity
Different teams write test cases at different granularity levels — some prefer atomic one-action steps, others prefer grouped steps. Your examples communicate this implicitly. But you can make it explicit too:
Granularity instruction add-on:
Write steps at the same granularity as the examples: each step is a single user action (one click, one input, one navigation). Do not group multiple actions in one step. Do not describe expected results within steps — keep all expected behavior in the Expected Result field only.
Or for teams that prefer grouped steps:
Write steps at a scenario level, grouping related actions into coherent blocks. Each step should describe a meaningful user action sequence, not individual micro-interactions.
Enforcing Vocabulary Consistency
AI will vary its vocabulary unless you constrain it. Inconsistent vocabulary in a test suite ("click," "tap," "press," "select" used interchangeably for the same action) creates friction and makes test cases harder to scan. Pull vocabulary from your existing test cases and list it:
Prompt add-on:
Use consistent vocabulary throughout, following these conventions from our existing test suite:
- "Click" for mouse interactions, "Tap" for mobile touch
- "Enter [value] in the [field name] field" for text input
- "Select [option] from the [dropdown name] dropdown" for dropdowns
- "Navigate to [page name]" for direct URL navigation
- "The [element] displays [text/state]" for assertions about UI content
- "The user is redirected to [page]" for navigation outcomes
Do not use "verify," "check," or "confirm" in steps — use these only in expected results.
Using AI to Normalize an Inconsistent Test Suite
If your existing test suite has inconsistent formatting, you can use AI to normalize it to a standard format using your best examples as the standard:
Prompt:
Reformat the following test cases to match the standard format shown in the examples. Do not change the test logic or steps — only standardize the formatting, field names, granularity, and vocabulary.
Standard format examples:
[PASTE 2-3 WELL-FORMATTED EXAMPLES]
Test cases to reformat:
[PASTE INCONSISTENTLY FORMATTED TESTS]
Learning Tip: Maintain a "golden test cases" document in your team wiki — a curated set of 5–10 test cases that represent exactly the quality, format, granularity, and vocabulary your team considers the gold standard. Refresh it quarterly. This document serves as the few-shot example set for all AI-assisted test generation sessions, and as the calibration document for new QA engineers joining the team. The investment in curating it pays back every time someone generates a new batch of tests.
How Should You Order Context in Your Prompt for Best AI Results?
The order in which you present context to an AI model meaningfully affects output quality. AI models process prompts sequentially, with recency and primacy effects — content near the beginning and end of a prompt gets more attention than content in the middle. Knowing this lets you structure prompts that reliably produce better output.
The Optimal Context Order for Test Case Generation
Research and practical experience with large language models suggest this ordering for test case generation prompts:
- Role/persona — Establish the AI's perspective first
- Task statement — What you're asking for, stated clearly upfront
- Output format specification — What the output should look like
- Acceptance criteria — The most important functional context
- User roles and permissions — Role-based context
- Data constraints and field rules — Validation-enabling context
- Design/UI context — State and flow context
- Example test cases — Format calibration context
- Additional constraints or notes — Last-minute instructions
- The specific feature description — At the end, because you want the AI to process all the context before it generates
The counterintuitive element: the feature description goes last, not first. This way, the AI has fully processed how you want to think about testing (your role, your output format, your coverage requirements, your constraints) before it encounters the feature and starts generating.
Full Ordered Prompt Template
Prompt:
## ROLE
You are a senior QA engineer with 10 years of experience testing [domain, e.g., e-commerce / fintech / SaaS] applications. You write thorough, executable manual test cases that other QA engineers can run without interpretation.
## TASK
Generate a complete set of manual test cases for the feature described at the end of this prompt. Cover positive paths, negative paths, and edge cases.
## OUTPUT FORMAT
For each test case, use this exact structure:
**ID**: TC-[3-digit number starting at 001]
**Title**: [One-sentence description of the scenario]
**Category**: [Positive | Negative | Edge Case]
**Priority**: [Critical | High | Medium | Low]
**Preconditions**: [Numbered list of conditions that must be true before test execution]
**Steps**: [Numbered list of specific executable steps]
**Expected Result**: [Observable outcome — UI state, message, navigation, data change]
**AC Reference**: [AC item ID this test validates, e.g., AC-01]
## ACCEPTANCE CRITERIA
[PASTE ACCEPTANCE CRITERIA WITH IDs]
## USER ROLES
[PASTE ROLE DESCRIPTIONS AND ACCESS LEVELS]
## DATA CONSTRAINTS
[PASTE FIELD-LEVEL VALIDATION RULES]
## UI/DESIGN CONTEXT
[PASTE WIREFRAME DESCRIPTION OR FIGMA SPEC SUMMARY]
## FORMAT EXAMPLES
[PASTE 2-3 GOLDEN TEST CASES]
## ADDITIONAL NOTES
[Any special constraints: "This feature is mobile-only," "Admin-only endpoints should be tested with both valid and invalid auth tokens," etc.]
## FEATURE DESCRIPTION
[PASTE FULL USER STORY AND ADDITIONAL TECHNICAL CONTEXT]
Why the Feature Goes Last: The Primacy-Recency Effect
In a long prompt, an AI model gives disproportionate weight to content at the beginning (primacy effect) and at the very end (recency effect). The middle sections get relatively less attention. By placing:
- Role and task first: The AI locks in the right perspective before processing anything else
- Format specification second: The AI generates in the right shape from the first test case
- Feature last: The AI has fully absorbed all the structural and contextual guidance before it starts generating — so it applies that guidance to the feature rather than defaulting to generic patterns
Chunking for Very Long Context
When your total context (AC + design spec + field constraints + examples) exceeds roughly 3,000 words, you risk hitting a point where the middle sections are under-weighted. For very large features, split the prompt into two passes:
Pass 1: Context ingestion
I'm going to give you context for a test case generation task. Acknowledge that you've received it and briefly summarize what the feature does and what the key testable behaviors are. Do not generate test cases yet.
[PASTE ALL CONTEXT]
Pass 2: Generation
Based on the context you just received, now generate the complete test case set following the output format I specified. Start with TC-001.
This two-pass approach forces the AI to process and synthesize context before generating, which tends to produce more cohesive output for complex features.
Context Reuse Across a Sprint
Once you've built a well-structured context prompt for a feature area, save the non-feature-specific parts (role, format, examples, team-specific notes) as a reusable "prompt header." For each new story in the same area, you only need to update the AC, user roles, and feature description sections. This dramatically reduces prompt preparation time.
Learning Tip: Create a prompt template file in your team's shared workspace with the full ordered structure pre-filled with your team's standard role definition, output format, golden test case examples, and vocabulary conventions. When you sit down to generate test cases for a new story, you're filling in four fields (AC, roles, constraints, feature description), not rebuilding the entire prompt from scratch. Teams that standardize their prompt templates see a consistent 3–4x improvement in first-pass test case quality compared to ad-hoc prompting.