Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

cargo-mutants

> 测试质量
Open source

:zombie: Inject bugs and see if your tests catch them!

1.2K stars0 likes2 views
WebsiteGitHub

About

:zombie: Inject bugs and see if your tests catch them!

cargo-mutants

cargo-mutants helps you improve your program's quality by finding places where bugs could be inserted without causing any tests to fail.

Coverage measurements can be helpful, but they really tell you what code is reached by a test, and not whether the test really checks anything about the behavior of the code. Mutation tests give different information, about whether the tests really check the code's behavior.

The goal of cargo-mutants is to be easy to run on any Rust source tree, and to tell you something interesting about areas where bugs might be lurking or the tests might be insufficient.

For more background, see the slides and video from my Rustconf 2024 talk.

The main documentation is the user guide at .

Prerequisites

cargo-mutants can help on trees with non-flaky tests that run under cargo test or cargo nextest run.

Install

bash
cargo install --locked cargo-mutants

You can also install using cargo-binstall or from binaries attached to GitHub releases.

Quick start

From within a Rust source directory, just run

bash
cargo mutants

To generate mutants in only one file:

bash
cargo mutants -f src/something.rs

Integration with CI

The manual includes instructions and examples for automatically testing mutants in CI, including incremental testing of pull requests and full testing of the development branch.

Help advance cargo-mutants

If you use cargo-mutants or just like the idea you can help it get better:

  • Post an experience report in GitHub discussions, saying whether it worked, failed, found interesting results, etc.
  • Sponsor development

Project status

As of August 2026 this is an semi-actively-maintained spare time project, although I've recently had less time to work on it. PRs and bugs will still be read with higher latency. I expect to make releases every few months at worst.

It's very usable as it is and there's room for lots more future improvement, especially in adding new types of mutation.

If you try it out on your project, I'd love to hear back in a github discussion whether it worked well or what could be better:

  • Did it work on your tree? Did you need to set any options or do any debugging to get it working?
  • Did it find meaningful gaps in testing? Where there too many false positives?
  • What do you think would make it better or easier?

This software is provided as-is with no warranty of any kind.

Further reading

See also:

  • cargo-mutants manual
  • How cargo-mutants compares to other techniques and tools.
  • Design notes
  • Contributing
  • Release notes
  • Discussions

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rustcargocargo-plugincargo-subcommandmutation-testing

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category测试质量
PricingOpen source

> Related tools

J
Jest
JavaScript 测试框架
P
Playwright
现代端到端测试框架
E
eslint-plugin-test-selectors
Enforces that data-test-id attributes are added to interactive DOM elements (JSX) to help with UI testing. JSX only.