DocsGetting Started
Getting Started
Install testgap and run your first test gap analysis in under a minute.
Installation#
testgap is a Rust CLI tool. Install it with cargo:
# From crates.io
cargo install testgap
# Or from source
git clone https://github.com/jadessoriano/testgap.git
cd testgap
cargo install --path crates/testgap-cliPrerequisites
You need Rust and Cargo installed. Get them from rustup.rs.
Quick Start#
Run a static analysis on your project — no AI, no API key needed:
cd your-project
testgap analyze --no-aiThis scans your codebase using tree-sitter, extracts all functions, matches them to tests, and reports untested functions classified by severity.
AI Analysis#
To get AI-powered risk assessment and test suggestions, set your Anthropic API key:
export ANTHROPIC_API_KEY="sk-ant-..."
testgap analyzeAPI Costs
AI analysis sends function signatures and gap details to Claude. Use
--ai-severity critical to only analyze critical gaps and reduce API costs.Output Formats#
testgap supports three output formats:
# Human-readable (default)
testgap analyze
# JSON (for CI pipelines)
testgap analyze --format json
# Markdown (for reports)
testgap analyze --format markdownConfiguration#
Create a .testgap.toml config file for your project:
testgap initThis generates a config file with sensible defaults. See the Configuration page for all options.
Best Practices#
Best use cases
- CI gate for untested public APIs
- Pre-release audit of test coverage
- Onboarding into an unfamiliar codebase
- Prioritizing which tests to write first
Tips
- Start with
--no-aito get a fast baseline without API costs - Use
--fail-on-criticalin CI to catch regressions - Use
--ai-severity criticalto control AI spend - Pipe JSON output to
jqfor custom filtering - Add
.testgap.tomlearly so the team shares settings
Not a replacement for runtime coverage
testgap uses static analysis — it doesn't run your code. Use it alongside tools like lcov, tarpaulin, or istanbul for complete coverage visibility.