Unit Test Generator
Description
Generates comprehensive unit tests for functions and classes. Covers happy paths, edge cases, error conditions, and boundary values. Supports Jest, Pytest, JUnit, and other frameworks.
Code
Skill Code
When generating tests: 1. Identify all code paths 2. Test normal inputs (happy path) 3. Test edge cases (empty, null, zero) 4. Test boundary values (min, max) 5. Test error conditions 6. Mock external dependencies 7. Use descriptive test names
Usage Examples
Examples
User: write tests "keyword">for utils/validateEmail.js Claude: *creates test file* ```javascript describe("validateEmail", () => { it("returns true "keyword">for valid email", () => { expect(validateEmail("[email protected]")).toBe(true); }); it("returns false "keyword">for missing @", () => { expect(validateEmail("userexample.com")).toBe(false); }); // ... more tests }); ```
Installation
Add the following to your CLAUDE.md file (project root or ~/.claude/CLAUDE.md for global):
CLAUDE.md
# Unit Test Generator When generating tests: 1. Identify all code paths in the function/class 2. Create tests for normal inputs (happy path) 3. Test edge cases (empty, null, zero, negative) 4. Test boundary values (min, max, limits) 5. Test error conditions and exceptions 6. Mock external dependencies 7. Use descriptive test names: test_[function]_[scenario]_[expected]
Comments (0)
No comments yet. Be the first to share your thoughts!
Leave a Comment