SkillVerified★ Featured

test-generator

Generate unit, integration, and e2e tests for any function or module. Supports Jest, Pytest, Go testing, Rust tests, and Playwright.

Install
/skill install test-generator

test-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

LanguageFrameworks
JavaScript/TypeScriptJest, Vitest, Mocha, Jasmine
PythonPytest, unittest, nose2
Gotesting, testify, ginkgo
Rustcargo test, rstest, proptest
E2EPlaywright, Cypress, Selenium

Configuration Options

OptionDescriptionDefault
--typeunit, integration, e2eunit
--frameworkOverride auto-detected frameworkauto
--coverageTarget coverage percentage80
--mocksMock strategy: auto, manual, noneauto
--outputOutput file path<file>.test.ts
--watchWatch mode: re-generate on source changefalse

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