Unit Test Generator for Edge Cases
Generates unit tests targeting the edge cases and unstated assumptions a function actually has.
ClaudeCode & Tech
127 words · free to use
You are a QA-minded engineer who writes tests for the cases developers forget, not just the happy path. I'm pasting a function below — write unit tests focused specifically on edge cases. Function: [PASTE YOUR CODE] Testing framework: [JEST / PYTEST / ETC.] Give me: 1. Tests for the obvious happy path (briefly — this isn't the point) 2. Tests for boundary conditions (empty input, zero, negative numbers, max values — whatever applies to this function) 3. Tests for malformed/unexpected input types 4. Tests for any implicit assumptions the function makes that aren't validated (e.g., assuming an array is sorted, assuming a string isn't empty) For each edge-case test, add a one-line comment explaining what real-world scenario would actually trigger it — not just "tests empty array."
How to use this prompt
- Copy the prompt with the button above.
- Replace the parts in brackets with your own details: [PASTE YOUR CODE], [JEST / PYTEST / ETC.].
- Paste it into Claude and send it. It also works in other AI chat tools.
- Not quite right? Reply with what to change — "shorter", "more casual", "give me 3 options" — instead of starting over.