cargo-mutants
Mutation testing for Rust: inject bugs and see if your tests catch them. Fast, parallel execution finds gaps in test coverage.
650
GitHub Stars
Rust
Language
2022
Released
Overview
cargo-mutants is a mutation testing tool for Rust that helps find gaps in test coverage by deliberately injecting bugs into your code. It systematically creates variants (mutants) of your codebase and runs your test suite against each one. If a mutant survives (tests still pass despite the bug), it indicates a gap in testing. The tool features parallel execution, smart filtering to avoid trivial mutations, and integration with Cargo's build system for seamless workflow integration.
The Verdict
Who Should Use cargo-mutants?
Best For
- Rust projects wanting to improve test quality beyond coverage metrics
- Teams seeking to identify gaps in edge case testing
- Critical codebases requiring high test confidence
Not Ideal For
- Projects with very slow test suites (mutation testing is time-intensive)
- Early-stage prototypes where test investment is low
What's Great
- Finds real test coverage gaps that line coverage misses
- Parallel execution speeds up mutation testing
- Smart filtering avoids trivial or equivalent mutants
- Integrates seamlessly with Cargo workflow
- Detailed reports show which mutants survived
Watch Out For
- Can be time-consuming even with parallelization
- Requires well-structured test suite for meaningful results
- May generate false positives for equivalent mutants
- Resource-intensive for large codebases
Pricing
View all features & details
Key Features
- Automatic mutation generation from Rust source
- Parallel test execution across mutants
- Smart filtering of trivial mutations
- JSON and text output formats
- Integration with CI/CD pipelines
- Incremental testing support
Platforms
- Linux (x86_64, aarch64)
- macOS (Intel, Apple Silicon)
- Windows (x86_64)
- Requires Rust toolchain
How It Compares
| Feature | cargo-mutants | PITest (Java) | Stryker (JS/TS) |
|---|---|---|---|
| Language | Rust | Java | JavaScript/TypeScript |
| Speed | Fast (parallel) | Fast | Moderate |
| Mutation Types | Rust-specific | Comprehensive | Comprehensive |
| CI Integration | Yes | Yes | Yes |
| Pricing | Free/OSS | Free/OSS | Free/OSS |
| Best For | Rust projects | Java projects | JS/TS projects |
User Reviews
Loading reviews...