Skip to content
QAcademy — QAcademy

Prompt engineering ·

Prompt Chaining for Testing: Analyze a User Story in 3 Human-Verified Steps

By The QAcademy team

Illustration for the article "Prompt Chaining for Testing"

You paste a user story and its acceptance criteria into a chatbot with an ambitious instruction: "Find the ambiguities, rewrite the criteria so they are testable, check nothing is missing, then propose test cases." The answer is three pages long and looks thorough. But somewhere in the middle, the model assumed a business rule that does not exist, rewrote two criteria based on it, then generated six test cases on top. The error is there, buried, and everything after it depends on it.

Prompt chaining addresses exactly this. Instead of one big request, you run a sequence of small ones, with a human check between each. This article shows how to apply it to user story analysis, with a complete three-step example, and when another technique is a better fit.

What is prompt chaining?

Out of the many prompting techniques cataloged in recent years (the syllabus points to Schulhoff et al., 2024), the ISTQB® CT-GenAI syllabus (section 2.1.2) retains three core ones for test tasks: prompt chaining, few-shot prompting and meta prompting. The idea comes down to two things:

  1. decompose a task into intermediate steps, each handled by its own prompt;
  2. check and refine the result of each step, manually or automatically, before moving on to the next one.

The second point is the one that matters. A long chatbot conversation is not, by itself, prompt chaining. What makes it a chain is the checkpoint: step 2 works on an output from step 1 that someone has reviewed and cleaned up.

Why prompt chaining works well for testing

  • Errors stop propagating. An invented assumption in step 1 is caught and removed before it contaminates what follows. The syllabus lists splitting complex prompts into verified steps among the ways to mitigate hallucinations and reasoning errors (section 3.1.3).
  • Each prompt is simpler. A short, focused instruction leaves less room for interpretation than one that stacks four tasks.
  • Review becomes realistic. Reviewing a list of six ambiguities takes two minutes. Nobody genuinely reviews three pages where everything is mixed together.
  • Each step can use its own technique. A structured prompt for analysis, a few-shot prompt for Gherkin formatting at the end, for example.
  • The result is traceable. You know which step produced what, and why a criterion was rewritten.

Even with models that can reason through multiple steps on their own, Anthropic's prompting documentation notes that explicit chaining is still useful when you need to inspect intermediate outputs. That is precisely what a tester needs.

Worked example: analyzing a user story with prompt chaining

This example follows the progression in the syllabus's hands-on objective HO-2.2.1b: ambiguities first, then testability, then completeness. Context and data are fictitious.

User story: "As a policyholder, I want to report a broken windshield online so that I quickly get a repair appointment."

Acceptance criteria (first draft):

  1. The policyholder can report glass damage if they are covered.
  2. The form asks for the date, the damaged glass and a photo.
  3. A repair appointment is offered quickly.
  4. If a deductible applies, the policyholder is informed.

Step 1: identify ambiguities

ROLE
You are an experienced tester reviewing a user story before the sprint starts.

INSTRUCTION
List the ambiguities, vague wording and missing information in the user story
and its acceptance criteria. For each one, write a question for the
Product Owner.

CONSTRAINTS
- Do not propose any rewrite at this stage.
- Do not assume any business rule that is not in the text. If you mention one,
  flag it as an assumption.

INPUT DATA
[user story + criteria 1 to 4]

OUTPUT FORMAT
Table: ID | Criterion | Ambiguity | Question for the PO

Output excerpt:

ID Criterion Ambiguity Question for the PO
A1 1 "Covered": by which cover, at what date? Must glass cover be active on the incident date or on the reporting date?
A2 3 "Quickly" is not measurable What is the maximum lead time for the first slot offered?
A3 2 Is the photo mandatory? Formats, size? Is the photo mandatory? Which formats and what maximum size?
A4 4 When and what information Is the deductible amount shown before submission?
A5 1 Claims must be reported within 5 days Confirm the 5-day reporting deadline

Human check. A1 to A4 are relevant. A5 is not: there is no reporting deadline anywhere in the story. The model brought it in from general insurance knowledge and did not flag it as an assumption, despite the constraint. You delete it (or turn it into a genuine open question if the doubt is legitimate). Then you get the PO's answers: cover active on the incident date; first slot within 5 business days; photo mandatory, JPG or PNG, 10 MB maximum; deductible shown in dollars before submission.

This cleaned-up, completed version is what feeds step 2, not the raw output.

Step 2: assess testability and rewrite the criteria

INSTRUCTION
Here are acceptance criteria and the Product Owner's validated answers.
For each criterion: rate its testability (testable / partly / not testable),
explain why, then propose a testable rewrite that incorporates the PO's
answers and adds nothing else.

INPUT DATA
[criteria 1 to 4]
[validated PO answers]

OUTPUT FORMAT
Table: Criterion | Testability | Reason | Proposed rewrite

Output excerpt, criterion 3:

Not testable: "quickly" has no threshold. Proposed rewrite: "After the report is submitted, at least one repair slot within the next 5 days is offered."

Human check. The rewrite lost a word: the PO said 5 business days, not 5 days. It looks minor, yet it moves the boundary values across a weekend. You fix it. You also check that the other rewrites add nothing the PO did not say.

Step 3: assess completeness

INSTRUCTION
Here is the user story and its validated acceptance criteria. Identify
situations these criteria do not cover (error cases, edge cases, policy or
claim states). For each one, say whether it is a likely missing criterion
or a point to confirm.

CONSTRAINTS
- Stay within the scope of the user story.
- No more than 8 items, ranked by impact on the policyholder.

INPUT DATA
[user story + validated criteria from step 2]

OUTPUT FORMAT
Numbered list: situation | missing criterion or point to confirm | rationale

Output excerpt:

1. Policy canceled or suspended on the incident date | likely missing criterion
2. Photo upload fails (network, size) | likely missing criterion
3. No slot available within 5 business days | point to confirm
4. A report already open for the same vehicle | point to confirm
5. Several windows damaged in the same incident | point to confirm

Human check. You keep 1 and 2 as criteria to add (once the PO agrees) and take 3 to 5 to the refinement session. Item 3 is valuable: without it, rewritten criterion 3 has no defined behavior when the repair network is fully booked.

You now have clear, testable, more complete acceptance criteria, plus a record of every decision. The next step, deriving test conditions and test cases, can rely on test design techniques and, for the output format, on a few-shot prompt.

What to check between steps

Step Question to ask Typical model error
Ambiguities Does every item come from the text? A business rule imported and stated as fact
Testability Does the rewrite keep the exact meaning? Rounded threshold, dropped condition, added requirement
Completeness Does every item stay in scope? Off-topic neighboring features, duplicates

Two habits make these checks effective. First, paste the corrected version explicitly at the start of the next prompt ("Here is the validated version: …"). In the same conversation, the model can still see its original, uncorrected answer and may fall back on it. Second, automate what can be automated: the syllabus allows checks to be manual or automatic. A script can verify that every criterion has an ID, that the table has the right number of columns or that the output is valid JSON. Judging meaning stays a human job.

Each prompt in the chain still benefits from the six-component structure (role, context, instruction, input data, constraints, output format): see our article on the structured prompt.

Prompt chaining vs meta prompting

The two are often confused because both involve several exchanges with the model. They do different things.

Prompt chaining Meta prompting
What you produce The task result, step by step The prompt itself
Recommended use (syllabus, 2.2.5) Complex tasks that need human verification at each step Flexible, new tasks where you do not yet know how to write the right prompt
Tester's role Check and correct every intermediate output Evaluate and adjust the suggested prompt, pairing with the model
Main risk A rushed check that lets the error through A well-phrased prompt that does not fit your context

They combine well. If you are not sure how to phrase the completeness step, ask the model to draft that prompt (meta prompting), review it, then plug it into the chain. Hands-on objective HO-2.2.2a in the syllabus does exactly this kind of mix: test case generation, then a coverage check, then a meta-prompt for end-to-end test procedures.

When not to use prompt chaining

  • The task is simple. Rephrasing a defect title does not need three steps.
  • Nobody will actually check. Without a checkpoint between steps, you pay for several requests and lose the main benefit.
  • Format is the only issue. If the analysis is sound and only the output style is wrong, few-shot prompting is more direct.

On the other hand, chaining is the natural choice when the task requires reasoning over several criteria (prioritizing by risk and dependencies, as in HO-2.2.2c) or when an early error would be expensive.

Key takeaways for the CT-GenAI exam

  • GenAI-2.1.2 (K2): tell prompt chaining apart from few-shot and meta prompting. The marker: decomposition into steps and verification of intermediate results.
  • GenAI-2.2.1 (K3) and HO-2.2.1b: apply prompt chaining and human verification to user story analysis (ambiguities, testability, completeness).
  • GenAI-2.2.2 (K3): HO-2.2.2a and HO-2.2.2c combine chaining with other techniques for test case generation and prioritization.
  • GenAI-2.2.5 (K3): choose the technique that fits the task.
  • GenAI-3.1.3 (K2): splitting prompts into verified steps as a way to mitigate hallucinations and reasoning errors.

To see how these objectives fit into the whole program, read the CT-GenAI certification guide and the exam guide.

FAQ

Do I need a special tool for prompt chaining?

No. A chatbot is enough, as long as you review each output and paste the corrected version into the next prompt. Frameworks and APIs pay off when the chain runs often and some checks are automated.

How many steps should a chain have?

One per subtask that deserves its own check, rarely more than three or four for a user story. If a step is hard to verify, it is probably too big.

Does prompt chaining eliminate hallucinations?

No. It makes them easier to catch early, nothing more. The quality of the result depends on the quality of the human check at each step.

Where to go next

Prompt chaining is one of the techniques chapter 2 of the syllabus comes back to most often. To find out where you stand on these topics, the free diagnostic takes 5 minutes and 10 questions, with no commitment.

Sources

  • ISTQB®, Certified Tester Specialist Level – Testing with Generative AI (CT-GenAI), syllabus v1.1, sections 2.1.2, 2.2.1, 2.2.2, 2.2.5 and 3.1.3: istqb.org
  • Anthropic, Prompting best practices – Chain complex prompts: platform.claude.com
  • IBM, What is prompt chaining?: ibm.com
  • S. Schulhoff et al., The Prompt Report: A Systematic Survey of Prompting Techniques, 2024: arxiv.org

Take the next step

You have just read. Now see where you stand: 10 questions, your score chapter by chapter, free and without signing up.

Take the free test (5 min)

Already decided to practise?

One-off payment, no subscription, refunded within 14 days if it is not for you.

Get the new articles by email

At most one email a week: the new QAcademy articles on software testing and quality. Free, unsubscribe in one click.

5 minutes · free · no sign-up

Before you go: where do you stand?

10 questions in the exam format, about 5 minutes: your score by chapter and your gap to the pass mark.

5 minutes · free · no sign-up