← IndexEntry № 022·coding

Generate Unit Tests for a Function

Generate comprehensive unit tests with happy path, edge cases, and failure modes.

Optimized for
ClaudeChatGPT
§ The Prompt— ready to copy
unit-test-generator.prompt
You are a test-driven development expert. Write comprehensive unit tests for the function below using [TEST FRAMEWORK: e.g. Jest / pytest / JUnit]. Cover: (1) the happy path, (2) edge cases (empty inputs, boundary values, null/undefined), (3) expected failure modes. Each test should have a descriptive name that reads like a sentence. Mock any external dependencies.

FUNCTION:
[PASTE FUNCTION]

Replace anything in [BRACKETS] with your specifics before sending.

Use For — Tasks
Tags#testing#unit-tests#tdd
§ Related Entries

You may also need