test-generator
Generate unit, integration, and e2e tests for any function or module. Supports Jest, Pytest, Go testing, Rust tests, and Playwright.
/skill install test-generatortest-generator
Generate comprehensive, idiomatic tests for any function, class, module, or API endpoint. test-generator understands your code's intent and produces tests that cover happy paths, edge cases, error conditions, and boundary values — across every major testing framework.
What It Does
test-generator performs deep code analysis to produce tests that actually matter:
- Coverage-driven generation: Analyzes branches, conditions, and return paths to maximize coverage
- Edge case discovery: Integer overflows, null/undefined inputs, empty collections, maximum length strings, concurrent access patterns
- Mock generation: Auto-generates mocks for external dependencies, HTTP clients, databases, and file system calls
- Fixture creation: Generates realistic test data and factory functions based on type signatures
- Assertion quality: Uses framework-idiomatic matchers (toBe, assertEqual, assert_eq) with meaningful failure messages
- Test naming: Descriptive test names following the "should X when Y" convention
- Framework detection: Auto-detects the testing framework in use from package.json, pyproject.toml, Cargo.toml, or go.mod
Installation
anvil skill install test-generator
Usage
Generate Tests for a File
/test-generator ./src/auth/jwt.ts
Generate Tests for a Specific Function
/test-generator ./src/utils/parser.ts --function parseUserInput
Generate Integration Tests
/test-generator ./src/routes/users.ts --type integration
Generate E2E Tests with Playwright
/test-generator ./src/pages/Login.tsx --type e2e --framework playwright
Generate Tests with Specific Coverage Target
/test-generator ./src/lib/ --coverage 90
Generate for a Python Module
/test-generator app/services/auth.py --framework pytest
Supported Frameworks
| Language | Frameworks |
|---|---|
| JavaScript/TypeScript | Jest, Vitest, Mocha, Jasmine |
| Python | Pytest, unittest, nose2 |
| Go | testing, testify, ginkgo |
| Rust | cargo test, rstest, proptest |
| E2E | Playwright, Cypress, Selenium |
Configuration Options
| Option | Description | Default |
|---|---|---|
--type | unit, integration, e2e | unit |
--framework | Override auto-detected framework | auto |
--coverage | Target coverage percentage | 80 |
--mocks | Mock strategy: auto, manual, none | auto |
--output | Output file path | <file>.test.ts |
--watch | Watch mode: re-generate on source change | false |
Requirements
- Source file or directory to generate tests for
- Compatible test framework installed in the project
Reviews
No reviews yet. Be the first!
Related Skills
Browser DevTools Mastery
Master Chrome DevTools for performance profiling, network analysis, memory debugging, and breakpoints.
TypeScript tRPC APIs
Build end-to-end type-safe APIs with tRPC, routers, procedures, middleware, and React Query integration.
Playwright E2E Testing
Write reliable end-to-end tests with Playwright, use locators, handle auth state, and run in CI.