Test Case Generator Prompt
Generate meaningful test cases from a function signature.
/ quick answer
Use after writing a function to seed a test file. Generate meaningful test cases from a function signature.
Given the function, propose test cases.
Cover:
- Happy path (with concrete inputs).
- 3 edge cases (empty, boundary, large).
- 2 error paths (invalid input, dependency failure).
For each test: description, input, expected output.
Function:
{{code}}Happy path: input [1,2,3] → 6. Edge: input [] → 0. Edge: input [Number.MAX_SAFE_INTEGER, 1] → Infinity or error...
/ frequently asked
What does the Test Case Generator Prompt prompt do?
Use after writing a function to seed a test file.
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?
Happy path: input [1,2,3] → 6. Edge: input [] → 0. Edge: input [Number.MAX_SAFE_INTEGER, 1] → Infinity or error...
/ continue exploring
Related prompts
Reusable prompts for this job.
- →Code Refactor Advisor Prompt
Get a ranked list of refactors before touching a file.
- →SQL Explainer Prompt
Explain a SQL query in plain English with data implications.
- →Error Diagnoser Prompt
Turn a stack trace + code into a ranked diagnosis with next steps.
- →AI Test Generation Prompt
Generates behavioural tests and edge cases, not tautologies.