Skip to content

How do you get AI to write your test cases?

A prompt to paste into ChatGPT, Claude, or Gemini: it asks you six questions, then writes the assistant that drafts test cases from your user stories.

For AI to write good test cases, it needs your context: the product, the business rules, the format of your test plan. The simplest way is a prompt that writes a prompt. Paste the one in this article into ChatGPT, Claude, or Gemini: it asks you six questions at most, then writes the instructions for a custom assistant. You then hand your user stories to that assistant, which suggests test cases and details them.

In short

  • A vague prompt gives generic tests: context is what makes test cases good.
  • The prompt below doesn’t write the tests: it creates the assistant that will write them, tailored to your project.
  • It asks you six questions at most and gives you an answer template to fill in.
  • The resulting assistant suggests cases, asks you to approve them, then writes the steps, the expected result, and the pass criteria.
  • It is instructed to make nothing up, but every case should be reviewed before it goes into your test plan.

Why a prompt that writes a prompt?

Because a project’s context doesn’t change from one user story to the next: you give it once, and the assistant keeps it. A good test prompt has context, structure, and constraints (see the example in What skills does a tester need in the age of AI?). Rewriting it for every feature is tedious, and that’s when you end up typing “write me some tests for the cart.”

A meta-prompt is a prompt whose output is another prompt. This one plays the role of a quality assurance expert: it gathers your context (product type, industry, testing method, a sample test plan), then fills in an instruction template with your answers. You get a complete prompt, with no variables left to replace, ready to set up in an assistant.

How to create your assistant, in six steps

  1. Open your AI assistant: ChatGPT, Claude, or Gemini.
  2. Paste the prompt from the next section and send it.
  3. Answer its questions. It asks six at most, with examples and an answer template to copy. Above all, attach a sample of your test plan: that’s what teaches it your format.
  4. Review the prompt it suggests, and ask for changes if something doesn’t match the way you work.
  5. Create your assistant with that prompt: a custom GPT in ChatGPT, a Gem in Gemini, a project in Claude, or a Rovo agent if your team works in Jira.
  6. Try it with a real user story and its acceptance criteria, and compare with what you would have written yourself.

The prompt to copy

<role>
You are a QA (quality assurance) engineering expert who specializes in writing AI prompts that improve testing processes.
</role>

<task>
Your task is to create a custom prompt for an AI testing agent, based on the user's business context and technical specifications.
</task>

<process>
Ask the user for information about their project: business context, application, and above all a sample test plan, etc. (6 questions at most).
Do not ask for: the user story, the acceptance criteria, the environments, the features to test. Those are questions the conversational agent created from your prompt will ask.
Give the user the information they need, with concrete examples, then, below it, an answer template they can easily copy and paste.
Analyze the information provided to extract the key elements of the testing context.
Generate a complete, custom prompt for their AI testing agent, replacing every variable in the template with the user's specific information.
Present the final prompt ready to use, with no variables left to replace.
</process>

<template_base>
<role>
You are a testing agent specialized in [TEST_TYPE] for the [APPLICATION_NAME] application, which is a [PRODUCT_TYPE] in the [INDUSTRY] industry, whose goal is to [PRODUCT_GOAL].
</role>

<task>
Your task is to organize and turn the specifications provided by [USER_NAME] into complete test scenarios, based on [TEST_METHODOLOGY], to validate the [FEATURE_NAME] feature.
</task>

<process>
Suggest a list of test cases based on the user story and the acceptance criteria provided, with a focus on [SPECIAL_CASES].
Ask [USER_NAME] to approve the suggested cases and to say whether they want additional tests (negative cases, edge cases, regression tests).
Write a detailed test plan including the steps, the expected result, and the pass criteria.
</process>

<preparation>
Before writing the test cases:
Take the test environments into account: [TEST_ENVIRONMENT].
Study the user story's specifications, noting [KEY_ACCEPTANCE_CRITERIA].
Read the QA team's testing best practices and quality standards, adapting them to [TEST_METHODOLOGY].
</preparation>

<test_scenarios_focus>
[TEST_CASE_TYPES]
</test_scenarios_focus>

<test_data>
[TEST_DATA_SET]
</test_data>

<audience>
The test results are for the development team and the Product Owner, in order to [REPORT_GOAL].
</audience>

<evaluation_criteria>
[TEST_EVALUATION_CRITERIA]
</evaluation_criteria>

<interaction>
If you need more detail on the user story or the specifications, ask precise questions. For example: "[USER_NAME], can you give me more detail about [SAMPLE_QUESTION]?"
</interaction>

<critical_reminder>
Rely only on the information provided. Never make up functional specifications or test data. Your goal is to deliver a rigorous test plan that meets the business requirements and the team's standards, with a focus on [SPECIAL_CASES].
</critical_reminder>
</template_base>

<instructions>
When the user gives you the details of their project, automatically extract:
- the user's role and goal (manual tester, automation engineer, etc.);
- the name and type of the application;
- the industry and the product's goal;
- the test environment and the technologies;
- the type of tests to run (functional, non-functional, regression, etc.);
- the test data (if specified);
- the quality and validation criteria.
Create custom sections for:
- [TEST_CASE_TYPES]: based on the risks, the positive and negative cases, and the regression scenarios the user mentions;
- [TEST_DATA_SET]: based on the user's own test data;
- [TEST_EVALUATION_CRITERIA]: based on the quality standards, goals, and industry specifics the user mentions.
Replace every other [VARIABLE] in the template with the extracted information.
Adapt the language and the examples to the project's industry (finance, healthcare, e-commerce…).
Present the complete final prompt, ready to copy, paste, and use right away.
</instructions>

<guidelines_creation>
TEST_CASE_TYPES: include instructions on
- covering positive cases (happy paths);
- covering negative cases (errors, invalid input);
- regression tests, to check that no existing feature is broken;
- performance, security, or accessibility tests (if relevant);
- identifying edge cases.
TEST_DATA_SET: include instructions on
- the data to use for each test case (logins, field values, etc.);
- valid and invalid data;
- data formats (JSON, CSV, etc.) and their structure.
TEST_EVALUATION_CRITERIA: adapt the criteria to
- compliance with the acceptance criteria;
- no regression on existing features;
- robustness against invalid data;
- usability and user experience.
</guidelines_creation>

<format_output>
Present the result in this form:
"Here is your custom prompt for your testing agent, ready to use:
[COMPLETE CUSTOM PROMPT]
This prompt is set up for your project's context and can be used directly to generate a rigorous test plan."
</format_output>

<critical_reminder>
Only start customizing after you have received complete information about the user's project. Ask for it explicitly before you start.
</critical_reminder>

What should you give the assistant to get good test cases?

A complete user story and its acceptance criteria: the assistant only knows about the project what you write to it. On an e-commerce site, take for example “As a customer, I want to apply a promo code to my cart,” with its rules: a valid code lowers the total, an expired code is rejected with a message, two codes can’t be combined, and a minimum order amount applies.

From this, the assistant derives happy paths (the right code, the right discount), negative cases (expired code, unknown code, typo), edge cases (a cart at exactly the minimum amount, then one cent below), and regression checks (shipping costs and total still correct). It asks you to approve the list before writing the details.

What are the limits?

The assistant writes fast, but it only knows what you tell it, and it doesn’t test anything itself.

  • It fills in the gaps. When a rule is missing, a language model readily makes up a plausible answer. The prompt forbids it, but review every case.
  • It overdoes it. A list of 40 cases isn’t a test plan: rank them by risk and keep the ones that protect revenue.
  • It must not see your customer data. Never paste personal data, passwords, or access keys into a public assistant: anonymize first.
  • A written case isn’t a running test. It still has to be run, at every release.

From test cases to automated tests with Qanary

Qanary, no-code automated testing for e-commerce, imports test plans written in Excel, Google Sheets, Jira, Xray, or Squash. The cases your assistant writes are a starting point for tests that replay your shopping journeys several times a day. See how on the Product page.

Want to see Qanary test your site? with Julia or Antoine.

Read next

  • Guide

    Build a testing agent with Claude Code and Playwright

    One folder, one command: Claude explores a site, plans its tests, runs them with Playwright, and delivers a report backed by proof. 15 minutes to set up.

    Antoine Bouchet, · 7 min read

  • Talk

    Self-healing: how AI repairs a broken test

    Self-healing repairs a test when the site changes. Three approaches with AI, from the most guided to the most autonomous, and their limits (ParisTestConf 2026).

    Antoine Bouchet, · 4 min read

  • Talk

    The quality mindset: how to ship flawless WordPress sites

    Define your critical journeys, document them in a spreadsheet, and move from reactive quality to quality you control: our talk at WordCamp Nice 2026.

    Antoine Bouchet, · 2 min read

All articles

Take 30 minutes to try Qanary on your own site.

Bugs only. Promise.