Repolode
mbj

mbj/mutant

Mutation testing for Ruby that modifies your code and reports which changes your test suite fails to catch.

Stars
2,212
Forks
163
Open issues
127
Last commit
yesterday

What is it?

Mutant is a mutation testing tool for Ruby. It systematically applies small changes to your code, such as swapping operators, removing statements, or altering return values, then runs your tests against each change. Mutations that no test fails on are reported as alive, which points to behavior your tests do not actually verify.

Each alive mutation calls for a decision: either simplify the code because the tests already pin down the correct behavior, or add the missing test. This is useful when code or tests are generated by AI tools, since passing tests alone do not show that the tests check anything meaningful.

Mutant integrates with RSpec, Minitest, and Test::Unit, and runs against Rails applications with per-worker database isolation. It supports incremental runs for CI, records session results for later review, and is free for open source use with a paid commercial license.

Key features

  • 01Applies operator, statement, and return-value mutations to Ruby code and runs tests against each one.
  • 02Reports alive mutations that point to untested behavior.
  • 03Integrates with RSpec, Minitest, and Test::Unit.
  • 04Supports Rails with parallel-worker database isolation for PostgreSQL and SQLite.
  • 05Offers incremental mode for running on CI and stores session history for reviewing past results.

Use cases

  • Checking whether tests written by AI assistants actually verify the behavior of the code.
  • Finding weak spots in an existing Ruby test suite before refactoring.
  • Running incremental mutation testing on CI for changed code only.

Quick start

  1. 1

    Install the RSpec integration gem

    gem install mutant-rspec
  2. 2

    Run mutant against a subject in your code

    mutant run --use rspec --usage opensource --require ./lib/person 'Person#adult?'

Things to know

  • Supported only on Linux and macOS.
  • Free only for open source; commercial use requires a paid subscription.
  • The README does not state a clear open-source license (metadata shows NOASSERTION).

In collections

Topics

#mutation-testing#ruby#testing#rspec#minitest#code-quality#rails#code-quality-analyzer#code-review#coverage

FAQ

What is mutant?
Mutation testing for Ruby that modifies your code and reports which changes your test suite fails to catch. Mutant is a mutation testing tool for Ruby. It systematically applies small changes to your code, such as swapping operators, removing statements, or altering return values, then runs your tests against each change. Mutations that no test fails on are reported as alive, which points to behavior your tests do not actually verify.
Is mutant free to use? What license does it have?
mutant is open source under the Other license. Check the license terms before using it in commercial products.
Is mutant still maintained?
Actively maintained. The last commit to mutant was on Nov 6, 2026.
What can I use mutant for?
Checking whether tests written by AI assistants actually verify the behavior of the code. Finding weak spots in an existing Ruby test suite before refactoring. Running incremental mutation testing on CI for changed code only.
How do I install mutant?
Install the RSpec integration gem: gem install mutant-rspec Run mutant against a subject in your code: mutant run --use rspec --usage opensource --require ./lib/person 'Person#adult?'
Where can I get mutant?
The source code and installation instructions are on GitHub: https://github.com/mbj/mutant

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects