← Back to Prompt Library
Code

Write Unit Tests

Generate comprehensive test cases for a function.

Write unit tests for the following [LANGUAGE] function using [TESTING FRAMEWORK — e.g., Jest, pytest, JUnit]. Include tests for: (1) Normal/expected inputs, (2) Edge cases (empty inputs, large values, null/undefined), (3) Error cases (invalid inputs, boundary conditions). Each test should have a descriptive name that explains what it's testing. Add comments explaining the rationale for non-obvious test cases. ``` [PASTE FUNCTION] ```
testingunit testsquality

Want to use this with one click inside ChatGPT?

Get TresPrompt →

Using AI? Optimize your prompts first.

Better prompts = better output = fewer revisions.

Try the Prompt Optimizer — Free →

100% client-side where applicable — your files and inputs stay in your browser. Nothing is uploaded to HundredTabs servers for these tools.