A mutation testing tool for Rust that injects bugs into your code to see if tests catch them.
cargo-mutants is a mutation testing tool for Rust that helps developers improve their program's quality by finding places where bugs could be inserted without causing any tests to fail. It works by injecting artificial bugs (mutants) into Rust source code and running existing tests to see if they detect these changes, providing different information than traditional code coverage measurements.
Rust developers and teams who want to improve their test suite quality and ensure their tests actually verify code behavior rather than just reaching code paths.
Developers choose cargo-mutants because it provides actionable insights about test effectiveness that coverage metrics miss, is easy to integrate into existing Rust projects, and helps identify subtle bugs that might otherwise go undetected by conventional testing approaches.
:zombie: Inject bugs and see if your tests catch them!
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Works out-of-the-box with cargo test and cargo nextest, requiring no complex setup as emphasized in the README for easy adoption.
Supports focusing on specific files using the -f flag, allowing efficient analysis of critical code sections without full codebase scans.
Includes documented instructions for automated CI pipelines, with features like incremental testing for pull requests to catch regressions early.
Reveals gaps in test effectiveness by injecting artificial bugs, providing information beyond traditional coverage metrics to improve quality.
Mutation testing requires running the test suite multiple times, which can be slow and resource-intensive for large projects or slow tests.
The README admits room for adding more mutation types, indicating current limitations in detecting diverse bug patterns effectively.
Requires non-flaky tests to function correctly; inconsistent tests can lead to misleading results or tool failures, as noted in prerequisites.