Skip to content
mentoor

Topic 2 of 5 · 5 min read

Generating realistic synthetic test cases

Goal: Generate synthetic cases from explicit dimensions and reject the ones that are unrealistic or near-duplicates.

Synthetic cases work when you decide the dimensions yourself, let a model write the inputs for each combination, and then filter hard; asking a model for "50 test cases" produces 50 near-copies.

Check yourself · 1 of 3

What should you decide before asking a model to generate test inputs?

Choose one answer

Why it matters

Real data is slow to collect and rarely covers the rare scenarios you most want to test. A model can write many plausible inputs quickly. But left alone it repeats itself: the same politely worded question, the same names, the same length. A set of 200 such cases behaves like 10.

How to do it

  1. Pick the dimensions. For a meeting-summary tool: meeting type (standup, sales call, board meeting), speaker count (2, 6, 12), problem (cross-talk, jargon, a decision reversed mid-call) and length (short, long). Each combination is a slot.
  2. Seed with real examples. Paste two or three real inputs into the generation prompt as style anchors. Cases generated from real seeds sound like real users. This is the idea behind the Self-Instruct method: start from a few human examples and let a model extend them.
  3. Generate per slot, not in bulk. One call per combination, asking for a handful of inputs and telling the model what must differ (names, tone, length, typos).
  4. Filter. Drop cases that are unrealistic ("Dear esteemed assistant"), too clean, or that leak the expected answer in the input. Remove near-duplicates with a similarity check or by hand.
  5. Review a sample by eye. Read at least 20 percent. If you cannot tell them from real inputs, they are good enough; if you can, tighten the prompt.
  6. Label the origin. Mark every case synthetic so you never report a score as if it came from real traffic.

Before and after

Weak prompt: "Write 50 test inputs for a meeting summariser." Result: 50 cheerful transcripts of the same product-planning meeting.

Fixed prompt for one slot:

Write 5 transcripts. Meeting type: sales call. Speakers: 6.
Problem: the customer reverses their decision halfway through.
Each transcript must differ in length (200 to 900 words), in
tone, and include at least one typo or filler word. Style
reference: <real transcript pasted here>

What goes wrong

  • Same model writes and answers. Its own phrasing is easy for it; cases are softer than real traffic.
  • No filtering. Duplicates inflate the pass rate and hide the real failures.
  • Treating synthetic as real. A synthetic score supplements the golden set; it does not replace it.

Examples

Generating one slot

The slot is persona = frustrated parent, feature = school-bus tracking, scenario = bus not arrived. The prompt asks for four messages that differ in length and tone, plus one with a spelling mistake. Two of the four come back sounding like a press release, so they are dropped and the prompt is revised to say "write the way people text from a phone".

A duplicate check

Of 120 generated cases, a similarity pass flags 38 as near-copies of an earlier one (same structure, only names changed). Keeping one of each leaves 82 cases that actually test different things.

Key points

  • Define dimensions and their combinations first; a model cannot invent a good coverage plan for you.
  • Seed the generation prompt with real examples so cases sound like real users.
  • Generate one slot at a time and say what must differ between the cases.
  • Filter for realism and near-duplicates, and read a sample yourself before trusting the set.
  • Tag every synthetic case as synthetic and report its scores separately from the golden set.

Common mistakes

  • Asking for a large batch in one call and keeping whatever comes back.
  • Skipping real seed examples, so the cases read like model prose.
  • Never reading the cases, so unrealistic or answer-leaking ones stay in.
  • Mixing synthetic and real cases in one pass rate with no label.

Check yourself · 2 of 3

Why paste two or three real examples into a generation prompt?

Choose one answer

Check yourself · 3 of 3

A model produced 100 synthetic cases and 40 are near-duplicates. What should you do?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic