Unit Test Suite Writer

Writes a thorough unit test suite for a function or module, including edge cases and failure paths.

78 words · free to use
Write unit tests for this code.

Language and test framework: [e.g. Jest, Vitest, pytest]
Code under test:
[PASTE]
How it is used: [CONTEXT]

Cover: normal cases, boundaries (empty, zero, max, very long input), invalid input, error paths, and any async or time-dependent behavior (mock clocks and network). Group tests clearly, name them so a failure explains itself, and avoid testing implementation details. After the tests, list any behavior that looks like a bug you found while writing them.
testingunit testsquality

How to use this prompt

  1. Copy the prompt with the button above.
  2. Replace the parts in brackets with your own details: [PASTE], [CONTEXT].
  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.