#cargo #mutation-testing #coverage #mutants

app cargo-mutants

Find inadequately-tested code that can be removed without any tests failing

37 releases (19 stable)

new 23.12.0 Dec 4, 2023
23.11.2 Nov 26, 2023
23.10.0 Oct 4, 2023
23.6.0 Jun 11, 2023
0.0.4 Nov 11, 2021

#26 in Testing

Download history 54/week @ 2023-08-17 69/week @ 2023-08-24 72/week @ 2023-08-31 71/week @ 2023-09-07 154/week @ 2023-09-14 48/week @ 2023-09-21 80/week @ 2023-09-28 90/week @ 2023-10-05 42/week @ 2023-10-12 70/week @ 2023-10-19 130/week @ 2023-10-26 98/week @ 2023-11-02 114/week @ 2023-11-09 68/week @ 2023-11-16 226/week @ 2023-11-23 322/week @ 2023-11-30

740 downloads per month

MIT license




Tests crates.io libs.rs GitHub Sponsors

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/.


cargo install --locked cargo-mutants

Quick start

From within a Rust source directory, just run

cargo mutants

To generate mutants in only one file:

cargo mutants -f src/something.rs

For more, see the user guide is at https://mutants.rs/.

Help advance cargo-mutants

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

Project status

As of October 2023 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.

Further reading

See also:


~364K SLoC