Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Rust
  3. mutagen

mutagen

Apache-2.0Rust

A mutation testing framework for Rust that evaluates test suite quality by injecting and activating code mutations.

GitHubGitHub
641 stars31 forks0 contributors

What is mutagen?

Mutagen is a mutation testing framework for Rust that evaluates the effectiveness of a test suite by injecting artificial bugs (mutations) into the source code. It helps developers identify weaknesses in their tests by checking if the test suite can detect these changes, going beyond simple code coverage metrics. The framework uses procedural macros to embed mutations at compile time and activates them at runtime via an environment variable.

Target Audience

Rust developers who want to rigorously assess and improve the quality of their test suites, particularly those working on projects where test reliability is critical, such as libraries, safety-critical systems, or applications with complex logic.

Value Proposition

Developers choose Mutagen over alternatives because it avoids recompilation by baking all mutations into the code upfront and activating them at runtime, significantly speeding up the mutation testing process. Its coverage-optimized execution mode further reduces time by running only tests affected by each mutation, making it practical for large test suites.

Overview

Breaking your Rust code for fun and profit

Use Cases

Best For

  • Evaluating the effectiveness of Rust test suites beyond code coverage metrics
  • Identifying weaknesses in tests for functions annotated with #[mutate] in development environments
  • Speeding up mutation testing for large Rust projects with its coverage-optimized execution mode
  • Safely experimenting with mutation testing in Rust without altering unsafe code or release builds
  • Integrating mutation testing into CI pipelines for Rust projects using cargo-mutagen
  • Testing Rust code where procedural macros can be applied without additional type information

Not Ideal For

  • Projects heavily reliant on unsafe code for core logic, as mutations are excluded from unsafe blocks and functions.
  • Teams needing mutation testing in production or release builds, since mutagen is designed for test mode only with dev-dependencies.
  • Developers seeking a stable, out-of-the-box tool, as it requires Rust nightly and installation from git due to unreleased versions.

Pros & Cons

Pros

Runtime Mutation Activation

Embeds all mutations at compile time and activates them via the MUTATION_ID environment variable, avoiding recompilation for each mutation and significantly speeding up the testing process.

Coverage-Optimized Execution

Supports a coverage mode that runs only tests affected by each mutation, drastically reducing execution time for large test suites, as highlighted in the README.

Safe Annotation Strategy

Uses #[cfg_attr(test, mutate)] to restrict mutations to test mode, preventing accidental changes in release builds and ensuring safe integration as a dev-dependency.

Unsafe Code Protection

Deliberately avoids mutations in unsafe blocks and functions to prevent undefined behavior and maintain code invariants, enhancing safety during testing.

Cons

Experimental and Unstable

The latest version (0.2.0) is not released on crates.io, requiring installation from git and Rust nightly, which adds setup complexity and instability.

Limited Mutation Capabilities

Cannot mutate const/static expressions or patterns due to procedural macro constraints, potentially leaving parts of the code untested for bugs.

Manual Setup and Activation

Requires manual annotation with #[mutate] and setting environment variables for each mutation, which can be tedious without tools like cargo-mutagen for automation.

Frequently Asked Questions

Quick Stats

Stars641
Forks31
Contributors0
Open Issues38
Last commit3 years ago
CreatedSince 2018

Tags

#hacktoberfest#procedural-macros#rust-ecosystem#test-coverage#dev-tools#code-quality#testing-tools#mutation-testing#rust

Built With

C
Cargo
p
procedural-macros
R
Rust

Included in

Rust56.6k
Auto-fetched 1 day ago

Related Projects

afl.rsafl.rs

🐇 Fuzzing Rust code with American Fuzzy Lop

Stars1,821
Forks116
Last commit6 days ago
mockallmockall

A powerful mock object library for Rust

Stars1,813
Forks79
Last commit16 days ago
synthsynth

The Declarative Data Generator

Stars1,483
Forks110
Last commit1 year ago
trusttrust

Travis CI and AppVeyor template to test your Rust crate on 5 architectures and publish binary releases of it for Linux, macOS and Windows

Stars1,276
Forks59
Last commit3 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub