cargo-mutants

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

https://github.com/sourcefrog/cargo-mutants

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.4%) to scientific vocabulary

Keywords

cargo cargo-plugin cargo-subcommand mutation-testing mutations rust rust-lang testing

Keywords from Contributors

argument-parser command-line-parser parsed-arguments positional-arguments subcommands interactive network-simulation hacking embedded optim
Last synced: 6 months ago · JSON representation

Repository

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

Basic Info
  • Host: GitHub
  • Owner: sourcefrog
  • License: mit
  • Language: Rust
  • Default Branch: main
  • Homepage: https://mutants.rs/
  • Size: 3.64 MB
Statistics
  • Stars: 961
  • Watchers: 6
  • Forks: 33
  • Open Issues: 85
  • Releases: 59
Topics
cargo cargo-plugin cargo-subcommand mutation-testing mutations rust rust-lang testing
Created over 4 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing Funding License Code of conduct Citation Security

README.md

cargo-mutants

https://github.com/sourcefrog/cargo-mutants

Tests crates.io libs.rs GitHub Sponsors Donate

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.

The main documentation is the user guide at https://mutants.rs/.

Prerequisites

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

Install

sh 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

sh cargo mutants

To generate mutants in only one file:

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

Project status

As of August 2025 this is an actively-maintained spare time project. I expect to make releases about every one or two months.

It's very usable at 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:

Owner

  • Name: Martin Pool
  • Login: sourcefrog
  • Kind: user
  • Company: @stripe

GitHub Events

Total
  • Create event: 114
  • Release event: 13
  • Issues event: 85
  • Watch event: 355
  • Delete event: 94
  • Issue comment event: 132
  • Push event: 225
  • Pull request review comment event: 12
  • Pull request review event: 17
  • Pull request event: 90
  • Fork event: 10
Last Year
  • Create event: 114
  • Release event: 13
  • Issues event: 85
  • Watch event: 355
  • Delete event: 94
  • Issue comment event: 132
  • Push event: 225
  • Pull request review comment event: 12
  • Pull request review event: 17
  • Pull request event: 90
  • Fork event: 10

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 1,613
  • Total Committers: 22
  • Avg Commits per committer: 73.318
  • Development Distribution Score (DDS): 0.038
Past Year
  • Commits: 326
  • Committers: 7
  • Avg Commits per committer: 46.571
  • Development Distribution Score (DDS): 0.046
Top Committers
Name Email Commits
Martin Pool m****p@s****t 1,552
Daniel Lambert d****0@g****m 14
Zane Duffield d****e@g****m 10
Paolo Barbolini p****i@m****t 5
ASuciuX a****u@h****o 4
Kevin Matthes 9****s 3
Oleksii Karpenko a****o@y****m 3
Scott Godwin s****s@g****m 3
dependabot[bot] 4****] 3
Vincent Berthier v****r@p****g 2
Naglis Jonaitis n****s@m****g 2
Brooks J Rady b****y@g****m 2
Denis Rangel d****s@i****t 1
Bruno Garcia b****c@g****m 1
Daniel Moka m****e@g****m 1
Dmitry Rodionov c****g@g****m 1
Johannes Marbach n****b@m****g 1
Mark Wainwright w****l@g****m 1
Tim Diekmann 2****n 1
Tim Heaney o****l@g****m 1
Yining z****g@g****m 1
mbp-stripe 8****e 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 240
  • Total pull requests: 237
  • Average time to close issues: 2 months
  • Average time to close pull requests: 5 days
  • Total issue authors: 40
  • Total pull request authors: 26
  • Average comments per issue: 1.51
  • Average comments per pull request: 0.71
  • Merged pull requests: 196
  • Bot issues: 0
  • Bot pull requests: 4
Past Year
  • Issues: 64
  • Pull requests: 74
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 5 days
  • Issue authors: 18
  • Pull request authors: 9
  • Average comments per issue: 1.0
  • Average comments per pull request: 0.73
  • Merged pull requests: 48
  • Bot issues: 0
  • Bot pull requests: 2
Top Authors
Issue Authors
  • sourcefrog (166)
  • ASuciuX (8)
  • xd009642 (7)
  • dmoka (5)
  • kpreid (5)
  • sandersaares (4)
  • cehteh (3)
  • zaneduffield (2)
  • yurivict (2)
  • mathstuf (2)
  • eirnym (2)
  • barafael (1)
  • anees-sequoiaat (1)
  • fence-sitter (1)
  • autarch (1)
Pull Request Authors
  • sourcefrog (283)
  • paolobarbolini (9)
  • kevinmatthes (7)
  • zaneduffield (6)
  • dependabot[bot] (5)
  • danjl1100 (4)
  • brunoerg (3)
  • LizardWizzard (3)
  • oylenshpeegul (2)
  • nfrankel (2)
  • cl3joly (2)
  • psandana (2)
  • naglis (2)
  • sgodwincs (2)
  • ASuciuX (2)
Top Labels
Issue Labels
enhancement (51) small (36) good first issue (28) bug (28) documentation (21) testing (14) generate (12) CI (10) performance (10) terminal ui (9) nextest (8) next (8) copy_tree (7) filter (6) internal (5) trial (5) large (4) maybe (4) output (3) timeouts (2) config (2) has workaround (1) infeasible (1) duplicate (1) modules (1) visit (1) sharding (1) wontfix (1) help wanted (1)
Pull Request Labels
dependencies (5) nextest (2) rust (2) documentation (1) performance (1)

Packages

  • Total packages: 3
  • Total downloads:
    • cargo 795,259 total
  • Total docker downloads: 18,688,465
  • Total dependent packages: 9
    (may contain duplicates)
  • Total dependent repositories: 15
    (may contain duplicates)
  • Total versions: 111
  • Total maintainers: 1
proxy.golang.org: github.com/sourcefrog/cargo-mutants
  • Versions: 44
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 6.4%
Average: 6.7%
Dependent repos count: 6.9%
Last synced: 6 months ago
crates.io: mutants

Decorator attributes to be used with cargo-mutants

  • Versions: 3
  • Dependent Packages: 9
  • Dependent Repositories: 15
  • Downloads: 593,597 Total
  • Docker Downloads: 18,688,465
Rankings
Docker downloads count: 1.0%
Dependent packages count: 3.8%
Downloads: 6.3%
Dependent repos count: 6.8%
Average: 6.8%
Stargazers count: 9.6%
Forks count: 13.5%
Maintainers (1)
Last synced: 6 months ago
crates.io: cargo-mutants

Inject bugs and see if your tests catch them

  • Versions: 64
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 201,662 Total
Rankings
Stargazers count: 10.6%
Forks count: 16.8%
Downloads: 20.3%
Average: 22.2%
Dependent repos count: 29.3%
Dependent packages count: 33.8%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/deploy-book.yml actions
  • actions/checkout v3 composite
  • actions/configure-pages v2 composite
  • actions/deploy-pages v1 composite
  • actions/upload-pages-artifact v1 composite
.github/workflows/install.yml actions
  • Swatinem/rust-cache v2 composite
.github/workflows/msrv.yml actions
  • Swatinem/rust-cache v2 composite
  • actions-rs/toolchain v1 composite
  • actions/checkout v3 composite
.github/workflows/mutate-self.yaml actions
  • Swatinem/rust-cache v2 composite
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
.github/workflows/scorecards-analysis.yml actions
  • actions/checkout ec3a7ce113134d7a93b817d10a8272cb61118579 composite
  • actions/upload-artifact 82c141cc518b40d92cc801eee768e7aafc9c2fa2 composite
  • github/codeql-action/upload-sarif 5f532563584d71fdef14ee64d17bafb34f751ce5 composite
  • ossf/scorecard-action c8416b0b2bf627c349ca92fc8e3de51a64b005cf composite
.github/workflows/tests.yml actions
  • Swatinem/rust-cache v2 composite
  • actions/checkout v3 composite
Cargo.lock cargo
  • 148 dependencies
Cargo.toml cargo
  • assert_cmd 2.0 development
  • insta 1.12 development
  • lazy_static 1.4 development
  • predicates 2 development
  • pretty_assertions 1 development
  • regex 1.5 development
  • walkdir 2.3 development
  • anyhow 1.0
  • camino 1.0
  • cargo_metadata 0.15
  • clap 4
  • clap_complete 4
  • console 0.15
  • cp_r 0.5.1
  • ctrlc 3.2.1
  • fs2 0.4
  • globset 0.4.8
  • itertools 0.10
  • mutants 0.0.3
  • nix 0.26
  • nutmeg 0.1.2
  • path-slash 0.2
  • proc-macro2 1.0.29
  • quote 1.0
  • rand 0.8
  • regex 1.5
  • serde 1
  • serde_json 1
  • similar 2.0
  • subprocess 0.2.8
  • syn 1
  • tempfile 3.2
  • time 0.3
  • toml 0.5
  • tracing 0.1
  • tracing-appender 0.2
  • tracing-subscriber 0.3
  • whoami 1.2
.devcontainer/Dockerfile docker
  • mcr.microsoft.com/vscode/devcontainers/rust 0-${VARIANT} build