Test Generator
Auto-generate unit tests from function signatures, JSDoc comments, and usage patterns. Supports Jest, Vitest, pytest, and Go testing.
Get the CLI Tool
Generate tests locally as an MCP server, or try it online below.
npx @clinetools/test-gen- Analyzes function signatures, types, and JSDoc to generate meaningful tests
- Generates edge case tests: null, undefined, empty, boundary values
- Supports Jest, Vitest, pytest, Go testing, and Mocha frameworks
- Creates describe/it blocks with proper setup and teardown
- Preference conversation on first run — choose framework, style, coverage targets
How to Use It
Three ways to generate tests — pick the one that fits your workflow.
Try Online
Paste a function below and get generated tests instantly — no install needed.
Use via CLI
Run as a local MCP server. On first run it asks about your test preferences.
Add to Cline / Claude Code
Add to your MCP settings so your agent generates tests automatically.
MCP Client Configuration
{
"mcpServers": {
"test-gen": {
"command": "npx",
"args": ["@clinetools/test-gen"]
}
}
}Example: Generate Tests for a Module
// Prompt to your AI agent:
"Generate comprehensive unit tests for
src/utils/validation.ts"
// The agent calls:
generate_tests({
file_path: "src/utils/validation.ts",
framework: "jest",
include_edge_cases: true,
coverage_target: 90
})
// Output: complete test file with describe blocks,
// happy path tests, edge cases, and error scenariosPreference Conversation (First Run)
// On first run, the tool asks: 1. "Which test framework do you use?" [x] Jest [ ] Vitest [ ] Mocha + Chai [ ] pytest (Python) 2. "What test style do you prefer?" [x] describe/it with nested groups [ ] Flat test() functions [ ] BDD-style (given/when/then) 3. "How thorough should generated tests be?" [ ] Quick — happy path only [x] Standard — happy + error cases [ ] Exhaustive — every edge case // Preferences saved to .clinetools/test-gen.json // Remembered for all future runs
Try It Online
Paste a function and get generated unit tests instantly.
Paste Source Code
We analyze function signatures, types, and comments to generate tests
Paste source code and click Generate Tests to create unit tests.
Generated Tests
Why Test Generation Matters
Writing tests is essential but time-consuming. AI-generated tests get you to 80% coverage in seconds.
10x Faster Test Writing
Writing tests manually takes 2-3x as long as writing the code itself. Generated tests give you a solid foundation in seconds — then you refine the edge cases that matter most.
Catch Edge Cases
Humans tend to test the happy path. Generated tests systematically cover null inputs, empty arrays, boundary values, and type coercion — the cases that cause production bugs.
Refactoring Safety Net
Generated tests create a baseline that catches regressions when you refactor. Change the implementation, run the tests — if they pass, your refactor is safe.
Documentation by Example
Tests are living documentation. Generated tests show how functions are supposed to be called, what inputs they accept, and what outputs to expect — better than comments.
Generate Tests In Seconds
Add the Test Generator to your agent's toolkit and never ship untested code again.
View Plans