AI Test Generation Prompt
Generates behavioural tests and edge cases, not tautologies.
/ quick answer
Use when adding coverage to existing code or a new AI feature. Generates behavioural tests and edge cases, not tautologies.
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}}1. describe('parseInvoice') → it('rejects a document whose line items do not sum to the total')...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.
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.
Related workflows
Turn this into a repeatable process.
- →Build a Test Suite for a Non-Deterministic AI Feature
Grade probabilistic output without brittle snapshot tests.
Related tool stacks
The tools that run it in production.
- →AI Testing Stack
Test deterministic code and probabilistic AI output in one pipeline.
Related prompts
Reusable prompts for this job.
- →Coding Agent Task Spec Prompt
Writes the task brief that keeps a coding agent inside scope.
- →AI Code Review Rubric Prompt
A reviewer prompt that finds real defects instead of style opinions.
- →Prompt Improver Prompt
Iterate a weak prompt into a strong one using best practices.
- →Test Case Generator Prompt
Generate meaningful test cases from a function signature.