
Write the requirements first
Define what a correct result contains and what it must avoid. For an enquiry summary, requirements could include the requested service, stated deadline, and missing information. Prohibited behavior could include inventing a budget or promising availability. “Sounds good” is too vague to be a reliable test.
Create a review sheet before trying the prompt. Use separate checks for factual accuracy, required fields, format, and unsupported claims. A polished answer can pass the tone check and fail the facts check. Keeping those scores separate makes a weakness visible rather than averaging it away.
Build a representative sample
Start with fictional or appropriately anonymized examples. Include a short ordinary request, a long request, missing fields, contradictory statements, and irrelevant instructions embedded in the text. Do not place private customer records in a new service merely to make the test realistic.
Write an expected result for each example. For ambiguous input, the expected behavior may be “ask for clarification.” That is a valid output. A test set containing only well-written inputs rewards a prompt that succeeds in a demonstration and struggles with the real queue.
Review evidence rather than fluency
Compare each output with the source. Highlight every factual statement and identify where it came from. If the summary says “urgent,” check whether the original message supports that interpretation. If it adds a deadline, it fails even when the rest is useful.
Record the reviewer’s correction and its impact. A formatting issue differs from a false commitment to a customer. Define which failures block use. Keep the raw output alongside the score so a future reviewer can understand the decision without reconstructing the entire experiment.
Revise one variable at a time
When a prompt fails, diagnose the instruction. A missing field may require a clearer output schema. An invented detail may require a rule to mark unknowns explicitly. More words are not always the fix; contradictory instructions can become harder to follow as the prompt grows.
Keep a version number and compare the revised prompt against the same examples. Also add a fresh example that was not used to design the correction. Otherwise you may simply tune the prompt to a familiar sample. Record the model and relevant settings because changing them changes the tested setup.
Keep testing after launch
Use human review during the pilot and collect new failure cases. Recheck the sample after a model, source, or format change. A previous test is evidence about a particular setup, not a permanent certificate.
Use the prompt-brief builder to keep task, sources, constraints, and output format explicit. Pair the test log with our results scorecard so quality and review effort remain part of the decision to continue.
Example: three different enquiry tests
Use one enquiry that states a service and deadline, one that names a service but no deadline, and one that asks for something outside the business’s scope. The expected outputs differ: preserve the stated deadline, mark the missing deadline, and route the out-of-scope request for review.
Suppose the prompt adds “within a week” to the second answer. The text may read naturally, but it fails the unknown-information rule. Revise the instruction to preserve unstated values, then run all three examples again. Check whether the correction damaged the ordinary case instead of considering only the previously failed answer.
Avoid this shortcut
Do not ask the model to grade its own confidence and treat that as an accuracy score. Use observable requirements and source comparisons. A confident false deadline remains a false deadline.
Build a test sheet with the right columns
Start with a small, deliberate set that covers the inputs your process actually receives — ordinary requests, ambiguous ones, missing information, and failures you have already seen. Ten cases can reveal obvious regressions, but they cannot establish a production accuracy rate. Twenty to fifty well-chosen cases are enough to start; grow the set from real failures as they happen.
| Column | What it records |
|---|---|
| Case ID | A short label so failures can be referenced later |
| Input | The exact text the prompt receives, anonymised |
| Expected behaviour | What a correct result must contain, in observable terms |
| Prompt version | Which version ran, so results stay comparable |
| Actual output | What the model returned, kept verbatim |
| Pass / fail | The verdict against the expected behaviour, plus reviewer notes |
Cover five kinds of case, not only the happy path: typical cases (the straightforward majority), edge cases (unusual but valid inputs), boundary cases (inputs at the limits of what the prompt handles), adversarial cases (inputs designed to break the prompt, including injection attempts), and failure cases (inputs the prompt should refuse or handle with an error rather than attempt to process). OpenAI’s evaluation guidance recommends task-specific tests and a feedback loop rather than relying on a few impressive examples, and its evals documentation describes structured test data and graders for repeatable assessment.
Compare versions on the same inputs
A change that fixes one case often breaks two others you did not look at. The fix is the same as for code: run the baseline and the revised prompt against identical inputs, keeping the model, the relevant settings, and the rubric consistent, and record the result for every case instead of selecting a few attractive examples. Without a baseline, you cannot see the trade-offs — you think you improved the prompt because your test case looks better, while ten other cases quietly got worse.
Ship only when the new version is at least as good overall and on every critical case. A simple release rule is: no new critical failures, no regressions on known high-risk cases, and a meaningful improvement in the intended outcome. With real models, run each case several times: outputs vary, and a one-case difference on fifty cases is usually noise. Keep prompts versioned like software contracts — one place, one version, one owner, and the model they were tested with — and log the prompt version with every call so a production failure can be traced back to the exact instructions that ran. Our guide to choosing an AI model for a task explains why the model version belongs in that record: prompts drift when providers update models, even when you changed nothing.
Turn every real failure into a regression test
When a real workflow fails, save a privacy-safe reproduction of the input, the expected behaviour, and the observed failure, and add it to the test set before rewriting the prompt. On the next revision, rerun the old failures as well as representative normal cases. Every production incident becomes a golden example — the case that proves the fix worked and guards against the same failure returning.
Regression testing is what separates a prompt that was fixed once from a prompt that stays fixed. Prompt changes, model updates, and even changes in connected tools can all move behaviour. A model provider releasing a new version can change how your prompt behaves without any change on your side, which is why the test set must be rerun on a schedule, not only after your own edits. Treat prompts like API schemas: every change needs a test plan, a baseline, and a rollback path. A golden dataset of at least fifty examples drawn from real production traffic, anonymised, is the production standard — block a merge when regression scores drop below the agreed threshold.
Keep the regression suite small enough to run often. A must-pass set runs on every change; the full evaluation runs nightly or before a release. Separate the model’s judgement from deterministic checks: validate required fields, allowed labels, destinations, and permissions in code or in the automation platform, so a format failure is caught before it reaches a customer. Our guide to troubleshooting automations shows how to classify the failure once a test catches it.
Score with code checks first, an AI judge second
Prefer code checks wherever the requirement is objective — they are free, fast, and consistent. A format check can confirm the output is valid JSON, that required fields are present, and that a label is one of the allowed values. Use an LLM judge only for qualities code cannot check: helpfulness, tone, and faithfulness to the source. Scoring with a second model is useful, but it is a judgement, not a measurement — treat its scores as a signal to inspect, not as a pass mark on their own.
Make safety failures binary and blocking. A single failure on a safety test case — producing prohibited content, revealing system-prompt information, following injected instructions, or including information the workflow should never share — blocks the release regardless of how well the prompt performs on everything else. Accuracy is the simplest overall metric: what fraction of test cases got the correct answer. But an average score hides critical failures, so inspect every critical failure individually, not only the average. Our guide to verifying AI-generated content covers the same discipline on the output side: check citations one by one, and never let a fluent answer stand in for a correct one.
Frequently asked questions
How many examples are enough?
There is no universal number. Start with enough varied cases to expose your main risks, then expand the set as real failures appear.
Can I use another AI to grade the answers?
It can assist with checking, but independently verify important factual and consequential claims. A second generated answer is not ground truth.
How many test cases do I need before launch?
Twenty to fifty well-chosen cases are enough to start — typical, edge, boundary, adversarial, and known-failure cases. Ten cases can reveal obvious regressions but cannot establish a production accuracy rate. Grow the set from real failures, and aim for a golden dataset of at least fifty examples drawn from real production traffic before you call the prompt production-ready.
Should I test with real customer data?
Only anonymised, and preferably not at all. Generate realistic inputs from your understanding of the task, or sample real inputs and strip identifiers first. Test data that still carries customer names, account numbers, or health details is a disclosure — our guide to safe data in AI workflows explains what never goes into a prompt.
What counts as a regression?
Any previously working behaviour that breaks: a format regression (JSON output now includes markdown fences), a quality regression (extraction accuracy drops from 94% to 87%), a latency regression (prompt bloat slows the first response), or a safety regression (an injection that used to fail now succeeds). Block the release on format and safety regressions; review quality regressions against the baseline.
Do I need to re-test when the model provider updates the model?
Yes. Prompts drift when providers update models, even though you changed nothing. Rerun the full test set after a model update, and keep the must-pass regression suite running on a schedule so silent degradation shows up in the trend before customers report it.
Was this guide helpful?
Tell us what needs improving →
Your selection stays on this page. To send feedback to the publication, use our contact form.
About this publication
From OptimaFlow AI
Practical guides to AI, automation, and better everyday workflows. We use illustrative examples and original diagrams, with AI-assisted writing and illustrations.
Read our editorial approach →About OptimaFlow AI