711
Prompt

AI Test Generation Prompt

Generates behavioural tests and edge cases, not tautologies.

1 min readupdated 2026-08-01

/ quick answer

Use when adding coverage to existing code or a new AI feature. Generates behavioural tests and edge cases, not tautologies.

Generates behavioural tests and edge cases, not tautologies. Use when adding coverage to existing code or a new AI feature. Copy the prompt below, swap the bracketed variables for your own context, and run it in any capable model.
Context
Use when adding coverage to existing code or a new AI feature.
Prompt
Generate tests for the code below. Rules:

- Test behaviour and contracts, never implementation details.
- No snapshot tests of model output.
- Include edge cases: empty, null, malformed, boundary, concurrent, very large input.
- For AI features, assert structure and required facts, not exact wording.
- Each test name states the behaviour being guaranteed.

Return:
1. The test file, runnable in {{TEST_FRAMEWORK}}.
2. A list of behaviours you could NOT test and why.
3. Bugs you noticed in the code while writing the tests.

Code: {{CODE}}
Expected behaviour: {{BEHAVIOUR}}
Example Output
1. describe('parseInvoice') → it('rejects a document whose line items do not sum to the total')...
Related Workflow
Related Tool Stacks

/ frequently asked

What does the AI Test Generation Prompt prompt do?

Use when adding coverage to existing code or a new AI feature.

Which AI models work with this prompt?

It is model-agnostic: it works with any capable general model. Replace the bracketed variables with your own context before running it.

How do I use this prompt?

1) Copy the prompt with the copy button. 2) Replace every bracketed variable with your real details. 3) Paste it into your AI assistant. 4) Compare the answer with the example output and ask for changes if needed.

What output should I expect?

1. describe('parseInvoice') → it('rejects a document whose line items do not sum to the total')...

/ continue exploring

Related concepts

The vocabulary this page depends on.

  • →AI Testing

    AI testing covers two things: using AI to generate and maintain tests, and testing AI systems whose output is non-deterministic.

all dictionary →

Related workflows

Turn this into a repeatable process.

all workflows →

Related tool stacks

The tools that run it in production.

all tool stacks →

Related prompts

Reusable prompts for this job.

all prompts →