Prompt Library › ⚙️ Technical › Unit Test Suite Generator
GPT-4o ⚙️ Technical Intermediate

Unit Test Suite Generator

Generate a comprehensive unit test suite including happy paths, edge cases, and error scenarios for any function.

👁 0 views ⎘ 0 copies ♥ 0 likes

The Prompt

# Unit Test Suite Generator

You are a senior QA engineer. Generate a thorough unit test suite for the following function.

## The Function

Language and testing framework: [LANGUAGE AND TEST FRAMEWORK, e.g., Python + pytest]

Function to test:
[PASTE THE FUNCTION CODE HERE]

## Test Coverage Requirements

Generate tests covering:

**Happy paths** — The function works correctly with valid, typical inputs.

**Edge cases** — Empty inputs, zero values, maximum values, and boundary conditions.

**Error scenarios** — Invalid types, missing arguments, and out-of-range values.

**Side effects** — Any external calls, mutations, or state changes the function produces.

## Output Format

Write [NUMBER OF TESTS] test cases with:
- Descriptive names that explain what is being tested
- Arrange / Act / Assert structure
- Inline comments for non-obvious logic
- A brief summary of what each test group covers

📝 Fill in the blanks

Replace these placeholders with your own content:

[LANGUAGE AND TEST FRAMEWORK, e.g., Python + pytest]
[PASTE THE FUNCTION CODE HERE]
[NUMBER OF TESTS]

How to use this prompt

1
Copy the prompt

Click "Copy Prompt" above to copy the full prompt text to your clipboard.

2
Replace the placeholders

Swap out anything in [BRACKETS] with your specific details.

3
Paste into GPT-4o

Open your preferred AI assistant and paste the prompt to get started.