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.
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
Hit "Run it in your AI"
We open ChatGPT, Claude, Gemini, Perplexity, Grok or Copilot with this prompt in the box, ready for you to press Enter — and copied to your clipboard as a backup. Pick your AI once and we remember it.
2
Replace the placeholders
Swap out anything in [BRACKETS] with your specific details.
3
Send it
This prompt is tuned for GPT-4o, but it works well in any of them. Prefer to do it by hand? Copy to clipboard is always there too.
Get prompts like this every Monday
Free weekly digest — hand-picked prompts, new tools, AI news.