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:

install.sh
# From crates.io
cargo install testgap

# Or from source
git clone https://github.com/jadessoriano/testgap.git
cd testgap
cargo install --path crates/testgap-cli

Prerequisites

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:

terminal
cd your-project
testgap analyze --no-ai

This 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:

terminal
export ANTHROPIC_API_KEY="sk-ant-..."
testgap analyze

API 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:

terminal
# Human-readable (default)
testgap analyze

# JSON (for CI pipelines)
testgap analyze --format json

# Markdown (for reports)
testgap analyze --format markdown

Configuration#

Create a .testgap.toml config file for your project:

terminal
testgap init

This generates a config file with sensible defaults. See the Configuration page for all options.

Best Practices#

Best use cases

Tips

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.