AI Test Stack
AI Foundations for QA Professionals/Level 5 — Prompt Engineering
Lesson

Prompts for Test Case Generation

Generate high-coverage test cases with prompt templates for positive, negative, boundary, abuse, and risk-based scenarios.

11 min read
Illustration of a ChatGPT and Copilot workflow that turns PRD details into categorized QA scenarios and structured test cases.
Illustration of a ChatGPT and Copilot workflow that turns PRD details into categorized QA scenarios and structured test cases.

Overview

Test case generation is one of the fastest ways for QA teams to get value from AI tools. It is also one of the easiest places to create false confidence.

If you paste a PRD into ChatGPT and ask for "all test cases," you usually get a long list that looks useful but misses important risks:

  • weak boundary coverage
  • repeated cases with different wording
  • missing negative scenarios
  • invented business rules
  • shallow expected results

This lesson teaches how to use ChatGPT and Microsoft Copilot tools productively for test design without outsourcing QA judgment.

A Practical Note for QA Learners

If this lesson feels dense, focus on these three ideas first:

  • give the model enough business context
  • force coverage categories instead of asking for generic test cases
  • review every AI-generated case like a QA lead, not like a copy-paste assistant

That mental model alone will already improve your results.

Learning Goals

  • Generate categorized test cases reliably from PRDs, user stories, and acceptance criteria.
  • Use ChatGPT and Copilot differently based on the job to be done.
  • Find edge cases hidden in business rules, field validation, and state transitions.
  • Produce outputs that are reviewable by manual QA and reusable by automation teams.
  • Generate supporting artifacts such as test data, traceability maps, and risk checklists.

Core Concepts

1. Use the Right Tool for the Right Stage

ChatGPT is usually better for:

  • long-form requirement digestion
  • exploratory what-if questioning
  • test strategy brainstorming
  • converting large PRDs into categorized scenario sets

Microsoft Copilot or GitHub Copilot Chat is usually better for:

  • working inside the repo or IDE context
  • generating structured test artifacts beside code
  • converting accepted scenarios into automation scaffolds
  • mapping requirements to existing APIs, fixtures, or helper libraries

Use them together instead of treating them as interchangeable.

2. AI Generates Faster When QA Thinks First

Before you prompt, define:

  • feature goal
  • user roles
  • business rules
  • validation rules
  • state transitions
  • data dependencies
  • failure impact

The model becomes much stronger when the QA engineer has already framed the testing surface.

3. Force Coverage Buckets

Never ask only for "test cases." Ask for:

  • happy path
  • negative path
  • boundary values
  • validation errors
  • state transition scenarios
  • role-based access
  • abuse or misuse cases
  • data integrity checks
  • integration failure paths
  • regression risks

4. Demand a Useful Output Contract

Good output fields include:

  • test ID
  • scenario title
  • category
  • preconditions
  • test steps
  • expected result
  • priority
  • automation candidate yes/no
  • notes on risks or assumptions

5. Prompt for Questions Before Test Cases

One of the strongest patterns is to ask the model to identify ambiguity first.

Example instruction:

text
2 lines
1Before generating test cases, list missing business rules, undefined validations,
2and workflow assumptions that could affect coverage. Do not invent answers.

That single step often reveals gaps that human reviewers missed in the original PRD.

Tool Strategy: ChatGPT vs Copilot

TaskChatGPTCopilot / GitHub Copilot ChatWhy
Summarize a long PRDStrongMediumChatGPT handles longer structured analysis well
Find missing edge casesStrongMediumBetter for broad reasoning and alternative paths
Create markdown test case tablesStrongStrongBoth can do it if structure is explicit
Create repo-aligned test stubsMediumStrongCopilot sees local code and helper patterns
Convert scenarios into Playwright skeletonsMediumStrongBetter inside IDE context
Draft exploratory chartersStrongMediumChatGPT works better for free-form thinking

A Strong Prompt Pattern for PRD-Based Test Design

Use a two-step workflow.

Step 1: Analyze the Requirement

text
13 lines
1You are a senior QA engineer reviewing a product requirement document.
2
3Task:
41. Summarize the feature in plain language.
52. Extract user roles, validations, workflows, dependencies, and failure risks.
63. List ambiguities or missing rules that could lead to coverage gaps.
74. Do not invent product behavior that is not in the source text.
8
9Return sections:
10- Feature summary
11- Key business rules
12- Missing information
13- Initial risk areas

Step 2: Generate Structured Test Cases

text
21 lines
1You are designing test cases for a QA team.
2
3Generate a structured set of test cases from the analyzed requirement.
4
5Coverage categories required:
6- happy path
7- negative
8- boundary
9- permission/access
10- state transition
11- integration
12- regression-sensitive
13
14Rules:
15- avoid duplicates
16- do not invent unsupported rules
17- write clear expected results
18- tag cases that are good automation candidates
19
20Return as a markdown table with columns:
21ID | Scenario | Category | Preconditions | Steps | Expected Result | Priority | Automation Candidate

Finding Edge Cases from PRD Documents

When you want edge cases specifically, ask narrower questions.

Example Prompt for Edge Case Mining

text
13 lines
1Review this PRD for a checkout discount feature.
2
3Find edge cases in:
4- field validation
5- currency handling
6- rounding
7- coupon expiration
8- duplicate coupon application
9- guest vs logged-in user behavior
10- retry and refresh behavior
11- partial failures from downstream pricing services
12
13Return only edge cases and explain why each one matters.

This tends to surface higher-value scenarios than a generic test-case prompt.

Test Data Generation with AI

AI is also useful for generating test data ideas, not only scenarios.

Use Cases

  • valid and invalid names
  • international phone numbers
  • addresses with tricky formatting
  • date combinations
  • malformed emails
  • boundary numeric values
  • realistic API payload combinations
  • masked but realistic financial-style records

Example Prompt for Test Data

text
16 lines
1Generate test data for a user-registration form.
2
3Fields:
4- first_name
5- last_name
6- email
7- phone
8- date_of_birth
9- postal_code
10
11Need:
12- 10 valid combinations
13- 10 invalid combinations
14- 10 boundary or tricky combinations
15
16For each record, explain what validation or risk it targets.

Practical Examples

Below are examples that manual QA and automation QA engineers can use immediately.

Example 1: ChatGPT for PRD to Scenario Draft

Input:

  • a new password-reset PRD

Goal:

  • generate initial coverage buckets

Good use:

  • broad scenario discovery

Example 2: ChatGPT for Ambiguity Detection

Ask:

text
2 lines
1Identify the business rules that are implied but not explicitly defined in this PRD.
2List questions a QA engineer should ask before test execution starts.

Example 3: ChatGPT for Boundary Analysis

Use it for:

  • min/max field lengths
  • numeric ranges
  • date windows
  • rate-limit thresholds

Example 4: ChatGPT for Risk-Based Prioritization

Ask for:

  • P0 / P1 / P2 prioritization
  • business impact
  • likely user-visible failures

Example 5: ChatGPT for Exploratory Charters

Prompt:

text
2 lines
1Convert these acceptance criteria into 5 exploratory testing charters.
2Each charter should focus on one risk theme and include a short mission statement.

Example 6: ChatGPT for Role-Based Coverage

Useful for:

  • admin vs normal user
  • guest vs authenticated
  • partner vs internal support user

Example 7: ChatGPT for Localization or Internationalization Cases

Ask for:

  • currency formatting
  • timezone effects
  • translated labels
  • right-to-left layout side effects if relevant

Example 8: ChatGPT for Data-Matrix Expansion

Use it to expand one rule into many combinations:

  • country x payment type
  • subscription tier x permission
  • browser x feature flag

Example 9: ChatGPT for Requirement-to-Test Traceability

Prompt:

text
2 lines
1Map each acceptance criterion to at least one positive and one negative test case.
2Flag any criterion that does not yet have enough information for reliable testing.

Example 10: ChatGPT for Regression Risk Reminders

Ask:

  • what nearby features are likely to regress?
  • which older workflows need smoke coverage?

Example 11: Copilot Chat for Repo-Aware Test Template Creation

Use when:

  • your project already has a test case format
  • your repo already stores cases as JSON, markdown, or YAML

Prompt inside IDE:

text
3 lines
1Using the existing QA markdown template in this repository,
2create a new test case document for the password reset PRD.
3Follow the same headings and naming conventions.

Example 12: Copilot Chat for Existing Test Coverage Gap Review

Ask Copilot:

text
3 lines
1Compare the PRD summary below with our existing Playwright specs in this repo.
2List which acceptance criteria appear uncovered.
3Do not assume coverage unless you can point to a relevant test file.

Example 13: Copilot Chat for Automation Candidate Tagging

Use it to label:

  • smoke candidates
  • regression candidates
  • complex manual-only cases

Example 14: Copilot Chat for Fixture-Aligned Test Data

Prompt:

text
2 lines
1Look at our existing test fixtures and propose new realistic records
2for boundary and negative cases related to checkout address validation.

Example 15: Copilot Chat for API-to-Scenario Mapping

If the feature spans UI and backend:

  • ask Copilot to link relevant endpoints
  • then derive missing scenario coverage

Example 16: Manual QA Workflow Example

Scenario:

  • new referral-code feature

Use ChatGPT to:

  • summarize rules
  • find edge cases
  • draft first-pass cases

Then the manual QA engineer:

  • removes invented assumptions
  • adds business-risk cases
  • adds exploratory charters

Example 17: Automation QA Workflow Example

Scenario:

  • subscription upgrade flow

Use ChatGPT to:

  • create scenario matrix

Use Copilot to:

  • map the final automation candidates into existing Playwright test structure

Example 18: Test Data Pack Generation

Use ChatGPT for:

  • diverse user profiles
  • invalid payment card combinations
  • malformed address cases

Use Copilot for:

  • converting the final set into local fixture files

Example 19: Negative Scenario Mining

Prompt:

text
3 lines
1Generate only negative scenarios for this feature.
2Exclude positive flows completely.
3Focus on validation, stale state, retry behavior, and unauthorized access.

Example 20: Executive Test Review Summary

Once cases are generated, ask:

text
2 lines
1Summarize the current test design in one page for a QA lead.
2Show major risk areas, missing information, and top automation candidates.

Example Output Shapes

Example ChatGPT Output Style

Good ChatGPT output for test design usually looks like:

  • grouped categories
  • concise scenario titles
  • assumptions called out
  • risks explained in plain language

Example Copilot Output Style

Good Copilot output usually looks like:

  • repo-aligned file names
  • test case structure that matches current team conventions
  • references to existing helper utilities
  • easier handoff into implementation

Manual QA Perspective

Use these prompts to improve:

  • test planning
  • exploratory coverage
  • review conversations with product owners
  • risk communication before release

Manual QA still adds the most value in:

  • judging business impact
  • identifying confusing UX flows
  • spotting unrealistic assumptions
  • testing ambiguous or evolving product behavior

Automation QA / SDET Perspective

Use these prompts to improve:

  • automation candidate selection
  • traceability from requirement to automated test
  • fixture and data design
  • test-case-to-spec conversion
  • regression pack design

Do not let AI skip:

  • selector strategy
  • cleanup logic
  • test isolation concerns
  • environment assumptions
  • determinism checks

Hands-On Lab

Lab: PRD to Reviewable QA Pack

Take one real feature document from your team and produce:

  • requirement summary
  • ambiguity list
  • risk list
  • 25 structured test cases
  • 10 edge cases
  • 10 test-data records
  • automation candidate shortlist

Do it in this order:

  1. Use ChatGPT for requirement digestion and broad case ideation.
  2. Review and trim the output manually.
  3. Use Copilot in your IDE to adapt the final scenarios to your repo format.
  4. Mark which cases belong in smoke, regression, or exploratory buckets.

Reflection Questions

  1. Which part of the workflow needed the most human correction?
  2. Which prompt change produced the biggest improvement in quality?
  3. Which cases looked convincing but were actually low value?
  4. Which outputs were directly reusable by automation engineers?

Key Takeaways

  • AI-generated test cases are strongest when the QA engineer forces coverage buckets and output structure.
  • ChatGPT is usually better for broad requirement analysis and scenario expansion.
  • Copilot is usually better for repo-aware adaptation and automation handoff.
  • PRD-based prompting should include ambiguity detection before test generation.
  • Test data generation is part of good test design, not an afterthought.
  • Human QA review is what turns AI output into production-ready coverage.

Next Step

Continue to Prompts for API and Backend Testing to apply the same discipline to contracts, payloads, state transitions, and backend risk analysis.