test-gen for Openclaw

An AI-driven CLI tool that automatically generates comprehensive unit tests for your source code to improve coverage and reliability.

lxgicstudios
v1.0.2
Jan 29, 2026
0
0
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install test-gen

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install test-gen using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is test-gen?

test-gen is a high-performance utility designed to bridge the gap between development and testing. By leveraging AI to analyze source files, it identifies testable functions and classes, crafting robust test suites that go beyond simple coverage metrics. This tool is a standout addition to the Openclaw Skills ecosystem, offering developers a zero-config solution to reducing technical debt.

Whether you are working with Jest, Vitest, or Mocha, this skill automates the creation of happy paths, edge cases, and error-handling scenarios. It is particularly valuable for teams looking to integrate modern testing standards into their existing workflows without the manual overhead of writing boilerplate test code.

test-gen Use Cases

  • Inheriting a legacy codebase with minimal test coverage.
  • Rapidly adding tests to newly developed features before a production release.
  • Meeting strict CI/CD coverage targets without compromising assertion quality.
  • Generating boilerplate tests for complex logic involving multiple dependencies.
  • Learning best practices for writing tests by observing AI-generated patterns for your specific code.

How test-gen Works

  1. The tool parses the provided source file or directory to identify testable units like functions, classes, and exported methods.
  2. It analyzes function signatures and internal logic to understand expected inputs and outputs.
  3. The AI generates comprehensive test cases covering typical usage, boundary conditions, and potential errors.
  4. It automatically mocks external dependencies to ensure tests remain isolated and performant.
  5. A final test file is generated in the specified framework (Jest, Vitest, or Mocha) with meaningful, readable assertions.

test-gen Setup

No permanent installation is required to start using this part of the Openclaw Skills library. You simply need Node.js 18+ installed on your machine.

# Run the tool directly using npx for a specific file
npx ai-test-gen ./src/utils.ts

# To view all available configuration flags and framework options
npx ai-test-gen --help

test-gen Data Schema & Taxonomy

The tool manages data by reading your source code and outputting structured test files according to your existing project structure. Below is how the data is handled:

Component Description
Input Files TypeScript or JavaScript source files (.ts, .js, .tsx, .jsx).
Output Files Structured test files compatible with Jest, Vitest, or Mocha.
Mocking Logic Automatic dependency injection and mocking based on detected imports.
Test Coverage Comprehensive coverage including Happy Path, Edge Cases, and Error Handling.

test-gen Advanced Features

  • Directory-wide processing to batch generate tests for entire services or modules.
  • Framework-specific optimization allowing you to toggle between Vitest, Jest, or Mocha environments.
  • Custom output path specification to align with unique project directory requirements.
  • Seamless integration with the broader LXGIC Dev Toolkit for a complete Openclaw Skills experience.
  • Intelligent dependency mocking that creates meaningful test stubs automatically.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*