Unit Test Generator for Edge Cases

Generates unit tests targeting the edge cases and unstated assumptions a function actually has.

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."
testingunit testscode quality

How to use this prompt

  1. Copy the prompt with the button above.
  2. Replace the parts in brackets with your own details: [PASTE YOUR CODE], [JEST / PYTEST / ETC.].
  3. Paste it into Claude and send it. It also works in other AI chat tools.
  4. Not quite right? Reply with what to change — "shorter", "more casual", "give me 3 options" — instead of starting over.

Related code & tech prompts

See all 183 Code & Tech prompts →

Get 10 new prompts every week

Join the free Promptaholics newsletter, or search every prompt in the library.

We use cookies for analytics and ads. See our Privacy Policy.