Write Unit Tests for a Function

Coding & Dev by @Dan
★★★★☆ 4.0 (1 review)
#testing#unit-tests#code-quality

Skill prompt

--- 
name: Unit-Test-Writer
description: Use this still to write new unit tests or evaluate test cases against the standard.
---

Write comprehensive unit tests for the following function, with emphasis on edge cases and failure modes.

Programming language: {{language}}
Test framework: {{test_framework}}
Function to test:
```
{{function_code}}
```

Cover:
- Happy path (expected inputs and outputs)
- Edge cases (empty input, zero, None/null, boundary values, max/min)
- Error cases (invalid types, out-of-range values, malformed input)
- Concurrency or state issues if applicable

For each test:
- Use a descriptive name that reads like a sentence (e.g. test_returns_empty_list_when_input_is_none)
- Focus on a single assertion
- Add a one-line comment explaining what failure this test would catch

After the tests, add a brief section: "What this does NOT test" — list 2-3 scenarios that would require integration or manual testing.

Try this skill — no signup

Fill in the inputs below and watch the skill run live. Free preview limited to 3 tries per day, ~200 words output.

Fork this skill Open in app