Skip to main content
Community resource — not affiliated with Anthropic. Learn more

Test Generator

Claude Code Plugin · Testing

Creates unit and integration tests from function signatures and implementation code. Supports Jest, Vitest, Pytest, Go testing, and Rust. Includes edge case generation and mock creation.

4.8 rating 8,900+ installs Free · Open source
FeaturedJestVitestPytestRust

Install Plugin

npx plugins add test-gen
Install Plugin →

Free · Open source · MIT license

8.9kInstalls
4.8Rating

What it does

Test Generator reads a function or module from your codebase and produces a complete test suite — including happy path tests, boundary conditions, error cases, and mock definitions for any external dependencies. It infers test structure from the implementation and generates descriptive describe and it blocks that double as living documentation.

Unlike simple stub generators, Test Generator reads the function body to understand intent — it generates tests that verify behaviour, not just that a function returns something.

How to install

terminal
npx plugins add test-gen

Supported frameworks

FrameworkLanguageStatus
JestTypeScript / JavaScriptFull support
VitestTypeScript / JavaScriptFull support
PytestPythonFull support
Go testGoFull support
Rust (cargo test)RustBeta

Example

input — TypeScript function
// src/auth/token.ts
export function parseJWT(token: string): JWTPayload {
  if (!token) throw new Error('Token is required');
  const [, payload] = token.split('.');
  return JSON.parse(atob(payload));
}
generated Jest test suite
// src/auth/token.test.ts
import { parseJWT } from './token';

describe('parseJWT', () => {
  it('parses a valid JWT and returns payload', () => {
    const payload = { sub: 'user-123', exp: 9999999999 };
    const token = `header.` + btoa(JSON.stringify(payload)) + `.sig`;
    expect(parseJWT(token)).toEqual(payload);
  });

  it('throws when token is empty string', () => {
    expect(() => parseJWT('')).toThrow('Token is required');
  });

  it('throws when token is undefined', () => {
    expect(() => parseJWT(undefined as any)).toThrow();
  });

  it('throws on malformed base64 payload', () => {
    expect(() => parseJWT('hdr.not-base64.sig')).toThrow();
  });
});

Configuration

.claude/plugins.json
{
  "test-gen": {
    "framework": "jest",
    "coverage-target": 80,
    "include-edge-cases": true,
    "mock-style": "vi.fn"
  }
}

Tip: Point the plugin at an entire module file rather than a single function to generate a full test suite covering all exported members in one pass.