In the pack: ChatGPT, Claude & Gemini Prompts for Coding and Developers
Unit Tests by Equivalence Class and Boundary
Prompt
Language and test framework: {{LANGUAGE}} / {{TEST_FRAMEWORK}}
Code under test: {{CODE}}
What it's supposed to do, if different from what the code says: {{INTENDED_BEHAVIOR}}
Do this:
1. List the input equivalence classes (groups of inputs the code should treat the same way), including invalid ones.
2. For each class, identify the boundaries: just below, at and just above each limit, plus empty, single-item and maximum-size cases.
3. Present a test table: case name, input, expected output or error, and which class and boundary it covers.
4. Write the tests in my framework: one behavior per test, descriptive names, arrange-act-assert layout, and parameterized tests where the framework supports them.
5. Flag any case where the code's actual behavior differs from the intended behavior. Write those tests to the intended behavior and mark them as expected to fail now.
Don't mock what you don't need to. Don't test private implementation details; test behavior through the public interface. If expected outputs require calculation, show the calculation so I can check it.
Customize this prompt
Fill in the variables below to personalize this prompt:
Model Settings
Recommended Models
Temperature
Max Tokens
Additional Notes
About this prompt
“Unit Tests by Equivalence Class and Boundary” is a free prompt for ChatGPT in the Coding & Software category, 191 words long, added to The Prompt Index on October 28, 2026 by The Prompt Index. Copy it with the button above, paste it into ChatGPT or any other AI chat assistant, and send it.
It has 4 placeholders to fill in first:
{{LANGUAGE}}, {{TEST_FRAMEWORK}}, {{CODE}}, {{INTENDED_BEHAVIOR}}.
Use the “Customize this prompt” fields to personalise it before you copy.
Recommended models: ChatGPT, Claude, Gemini.
0 upvotes, sent to an AI tool 0 times, viewed 4 times.
Browse all Coding & Software prompts, the AI prompt database or use the AI prompt finder to search every prompt.