Skip to the content
Know your tech before you buy it. Makers: get listed from $49/mo

muttest-rs

github.com

  • Free plan
6.7 Club score Visit github.com

What muttest-rs is

muttest-rs is a free, MIT-licensed Rust tool for checking whether tests detect simulated code defects. It creates mutations in selected source code, runs Rust or Cargo tests, and records surviving mutants in target/muttest/report.json. The documented setup installs the cargo-muttest Cargo plugin and adds muttest as a crate dependency. For library analysis, developers annotate code and test modules, run cargo muttest --lib, and inspect the JSON report. Integration tests use muttest as an optional dependency, attributes guarded by the muttest feature, and cargo muttest without --lib. Its #[mutate] macro transforms selected source patterns and adds runtime hooks, allowing mutations after one compilation. Runtime-executed expressions can be mutated, but const and static definitions, const functions, macros and their arguments, patterns, and types are excluded. Only top-level module items can receive the annotation. An optional optimized Cargo profile uses optimization level 3 and link-time optimization for mutation-heavy analysis.

Who it suits

It suits Rust crate developers evaluating how well their unit and integration tests catch code changes. Users should keep muttest out of release code as documented.

Good to know, and what to watch

  • Free and open source under the MIT license
  • Reports surviving mutants in JSON
  • Supports library and integration test workflows
  • Runtime hooks allow one compilation
  • Optional optimization profile is documented
  • Cannot mutate const or static definitions
  • Macros, patterns, and types are excluded
  • Annotations apply only to top-level module items

The verdict

muttest-rs provides a focused mutation-analysis workflow for Rust/Cargo projects. Its documented exclusions should be checked when deciding which code and tests to evaluate.

What the maker publishes

Annotation limit
Only top-level items in modules can be annotated with `#[mutate]`. source
Annotation limits
For technical reasons, only top-level items in modules can be annotated with `#[mutate]`. source
Debugging
Setting `RUST_LOG=debug` displays the commands executed during mutation analysis. source
How it works
Its `#[mutate]` macro transforms source code patterns and adds hooks so mutations can be enabled at runtime after a single compilation. source
Installation
The documented setup installs the `cargo-muttest` Cargo plugin and adds `muttest` as a crate dependency. source
Installation
The README instructs users to install the `cargo-muttest` Cargo plugin and add `muttest` to their crate. source
Integration tests
To include integration tests, the README says to use `muttest` as an optional dependency, guard attributes with the `muttest` feature, and run `cargo muttest` without `--lib`. source
Integration tests
The README says integration test analysis uses `muttest` as an optional dependency and runs `cargo muttest` without `--lib`. source
Intended users
The documented setup is for Rust crate developers who want to assess how well their tests detect code changes. source
License
The repository identifies its license as MIT. source
License
The repository includes an MIT license that permits use, copying, modification, distribution, sublicensing, and sale subject to its terms. source
Mutatable code
The tool can mutate runtime-executed expressions, but not const or static definitions, const functions, macros and their arguments, patterns, or types. source
Mutation limits
It cannot mutate const or static definitions, `const fn`s, macros or their arguments, patterns, or types. source
Performance
The README documents an optional `muttest` profile with optimization level 3 and LTO to optimize the test suite during mutation analysis. source
Performance option
The README describes an optional Cargo `muttest` profile with optimization level 3 and link-time optimization for mutation analysis dominated by mutant evaluation. source
Purpose
muttest simulates bugs by changing code so a test suite can be evaluated by whether it catches those changes. source
Purpose
muttest-rs is a Rust mutation testing tool for evaluating whether a test suite catches simulated bugs. source
Release-code guidance
The README instructs users to ensure muttest does not affect release code. source
Reports
The tool writes a JSON report to `target/muttest/report.json`. source
Runtime mutation
The `#[mutate]` macro transforms selected source patterns and inserts hooks to enable mutations at runtime, allowing the code to be compiled once. source
Test setup
For library tests, the README shows annotating code and test modules, then running `cargo muttest --lib`. source
Unit test workflow
For library mutation analysis, the README directs users to annotate code and test modules, run `cargo muttest --lib`, and inspect `target/muttest/report.json`. source

Checked against the maker's pages on 9 Oct 2026.