QA Interview Hub · Knowledge base · Quizzes · Українська

QA Fundamentals › AI in testing

How do you write prompts to get decent test cases and not fluff?

Usable test cases need a prompt written as a minimal specification: without rules and a format the model fills gaps with generic phrases. The prompt gives the context (feature description, business rules with numbers, acceptance criteria) and names the test design techniques and the output format. It forbids inventing and asks for unclear points as questions. The request is then refined iteratively and good prompts are kept as templates.

QA Fundamentals · AI in testing

You ask "write test cases" and get three lines like "check a valid amount". What to change in the request?

A typical first experience: a QA types "write test cases for a transfer", gets "check a transfer with a valid amount", "check with an invalid one" and a few more generic lines. They become usable only after a full rewrite. That is not a weak model but a weak request. The lesson covers why this happens, what a prompt that yields a usable result consists of, and how to check what comes back.

How it works and why. The model continues the context in the most probable way. If the request has no rules, boundaries or format, the model fills them with what is most common in similar texts: generic phrases. A prompt is best treated as a minimal specification for an executor who knows nothing about your product. It has several parts:

  • Context: a feature description, business rules, acceptance criteria. This is the main part: the model takes boundaries and expected results from it.
  • Role and goal: "a QA Engineer on a fintech product" narrows style and vocabulary; a role does not add competence by itself.
  • Techniques: name the ones you need (equivalence classes, boundary values, a decision table), otherwise it picks arbitrary ones.
  • Format: table columns, language, size; an example of one good case fixes the style.
  • A ban on inventing and a request to list the unknown separately as questions: this turns gaps in requirements from hidden mistakes into visible questions.

What a generic and a specific prompt return

Typical

"Check a transfer with a valid amount"

Three or four lines with no values and no expected result: each can be run in different ways and there is nothing to check against.

Better

0.99 rejected, 1.00 accepted, fee 5.00

Concrete boundaries, values and a result by the prompt's rules. The row runs the same way each time and exposes a mismatch with the requirement at once.

Figure 1. The difference between "fluff" and a useful result is almost always in what was in the context, not in "magic words" of the prompt.

Example: from a generic request to a usable result. The same idea worded two ways:

Before:
  Write test cases for a transfer.

After:
  You are a QA Engineer on a fintech product. Feature: a card-to-card
  transfer.
  Rules: amount 1.00-10,000.00 UAH, 2 decimal places, daily limit
  20,000, fee 1%, minimum 5 UAH.
  Apply equivalence classes and boundary values (6 values per
  range), add negative scenarios, a double submit and a timeout.
  Format: a table ID | Preconditions | Steps | Expected result.
  Do not invent rules that are not stated above. If something is
  missing, list it separately as questions and do not put it into
  the cases.

The second request is longer, but each line carries needed information: the rules give boundaries, the technique sets the way of enumerating, the format sets a usable structure, and the last requirement stops the model from guessing. A typical result of such a request (an AI draft, an illustration):

ID    Preconditions     Steps                   Expected result
TC-03 balance 20,000    transfer 0.99           rejected: "minimum 1.00"
TC-04 balance 20,000    transfer 1.00           accepted, fee 5.00
TC-07 balance 20,000    transfer 10,000.01      rejected: above the limit
TC-11 balance 20,000    double-click "Send"     exactly one transfer created

Questions: does the fee count towards the daily limit? Does
the minimum fee apply to the amount 1.00 too?

Notice how these rows are checked. The boundaries 0.99 and 1.00, 10,000.00 and 10,000.01 are compared with the range in the requirement. The row about the fee 5.00 applies a rule from the prompt, and QA checks that the requirement really says so. And the two questions at the bottom are the most valuable part: they show that the requirement is incomplete, and the analyst, not the model, answers them.

Limits and alternatives. A long prompt guarantees nothing by itself: contradictory rules or extra fluff make the result worse. The result is iterative: after the first answer you ask to add security scenarios, network failures and states instead of demanding everything at once. For repeatable tasks the prompt is stored as a template in a repository or in team notes and improved like any artifact. An example in the prompt strongly affects the style, but models sometimes copy it too literally, so give an example from another feature. Prompts contain no real customer data, only made-up values. An alternative to a long prompt is a tool that already embeds your templates, or giving the model the requirements in a file and asking it to follow a template from a file.

Common mistakes.

  • "Write as many cases as possible": quantity instead of substance, resulting in duplicates and obvious variations.
  • A feature description without numbers: without boundaries the model invents its own, and they look plausible.
  • Not asking to separate assumptions from facts: invented rules slip into the cases unnoticed.
  • Fixing the result by hand instead of refining the request: next time everything has to be repeated.
  • Putting real cards, names and tokens into the prompt.

Check yourself

The prompt says: "The transfer limit is small. Write boundary values". What goes wrong and how to fix it?

Answer

The prompt has no limit number, so the model invents boundaries (say 1000) and states them confidently. Add the exact range from the requirement, and add at the end "if something is missing, list it as a question, do not invent".

Why can a request "list the questions about the requirements that remain unclear" give a more valuable result than the cases themselves?

Answer

Because it exposes gaps in the requirements before tests are built on them. A case written against an incomplete requirement only fixes the rule the model made up, while a question goes to the analyst and removes the cause, not the symptom.

In an interview. Junior: I give the model context: a feature description, business rules and acceptance criteria, and name the test design techniques and the output format. I separately ask it to list unclear questions about the requirements instead of inventing. Then I iterate: I ask what is missing on security or failures. Middle/Senior: For me a prompt is a task specification: rules with numbers give boundaries, a technique sets the way of enumerating, a format gives a usable structure, and a ban on inventing separates assumptions from facts. I check the result against the requirements, and I keep good prompts as team templates, without real data in them.

More articles in this chapter