登录 注册

mutant

去点 Star
开发者工具
2,213
Stars
—
Forks
0
Watchers
—
Open Issues
待补全
许可证
Ruby
语言
—
创建时间
最近更新

项目能做什么

Ruby 变异测试工具,专门用于检验测试用例本身的质量。
来源:基于仓库元数据 · 内容以仓库实际 README 为准

使用说明 查看原始 README 原仓库文档

中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
mutant
======

[![Build Status](https://github.com/mbj/mutant/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/mbj/mutant/actions/workflows/ci.yml)
[![Gem Version](https://img.shields.io/gem/v/mutant.svg)](https://rubygems.org/gems/mutant)
[![Gem Downloads](https://img.shields.io/gem/dt/mutant.svg)](https://rubygems.org/gems/mutant)
[![GitHub Stars](https://img.shields.io/github/stars/mbj/mutant.svg)](https://github.com/mbj/mutant)
[![Discord](https://img.shields.io/discord/767914934016802818.svg)](https://discord.gg/BSr62b4RkV)

## What is Mutant?

**AI writes your code. AI writes your tests. But who tests the tests?**

Copilot, Claude, and ChatGPT generate code faster than humans can review it. They'll even
write tests that pass. But passing tests aren't the same as *meaningful* tests.

Mutant is mutation testing for Ruby. It systematically modifies your code and verifies your
tests actually catch each change.

The more code AI writes for you, the more you need verification you can trust.

## What is an Alive Mutation?

Each surviving (alive) mutation is a call to action with exactly one of two options:

- **Keep the mutated code** - your tests already specify the correct semantics, and the
  original code is redundant. Accept the mutation as a simplification.
- **Add the missing test** - the original code is correct, but the tests don't verify the
  behavior the mutation removed.

## Author

Mutant was created and is developed by [Markus Schirp](https://schirp-dso.com).
It is the subject of [IEEE-published research](https://ieeexplore.ieee.org/document/7107453/)
and is included in the [Trail of Bits Ruby Security Field Guide](https://trailofbits.github.io/rubysec/mutant/index.html).

## Quick Start

```ruby
# lib/person.rb
class Person
  def initialize(age:)
    @age = age
  end

  def adult?
    @age >= 18
  end
end
```

```ruby
# spec/person_spec.rb
RSpec.describe Person do
  describe '#adult?' do
    it 'returns true for age 19' do
      expect(Person.new(age: 19).adult?).to be(true)
    end

    it 'returns false for age 17' do
      expect(Person.new(age: 17).adult?).to be(false)
    end
  end
end
```

Tests pass. But run mutant:

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

Mutant finds a surviving mutation indicating a shallow test:

```diff
 def adult?
-  @age >= 18
+  @age > 18
 end
```

Your tests don't cover `age == 18`. The mutation from `>=` to `>` doesn't break them.

This is just one of many mutation operators. Mutant also mutates arithmetic, logical,
bitwise operators, removes statements, modifies return values, and more.

A full working example is available in the [quick_start](quick_start/) directory.

## Session History

Mutant records every run to `.mutant/results/`, and keeps the 100 most recent.
You can recall past results without re-running mutation testing:

```bash
# List past sessions (most recent first)
mutant session list

#
阅读完整原文

项目深度分析 规则生成(AI 未配置)

综合评分 58.1 分。该项目在“个人可实施性”维度得 40 分,“付费可能性”维度得 20.0 分,差异化空间 100.0 分(评分依据见评分卡)。

面向细分需求的二次开发产品

产品构想基于 mutant 的核心能力,聚焦一个更窄的场景(如某平台、某行业)做差异化。
目标用户该细分场景用户
难度/周期中 · 2~6 周
收费模式买断制 / 订阅制 / 广告
竞争风险细分需求规模需验证
依据 AI 推测:基于项目主题标签的判断
以上为规则引擎基于仓库公开数据生成的参考结论,包含推测成分,不构成投资或创业承诺;配置 AI 后可获得更深入的分析。
报告会保存到 个人中心

竞品与相似项目 GitHub Search 真实检索

相似项目数据正在完善中,暂不展示(避免误导)

项目优势与风险

技术成熟度创建时间待补全,最近推送 ,发布过 5 个 Release
社区活跃Star 2,213 / Fork 0 / Issue 0(数据支持,可自行核实)
许可证未检测到(需人工确认)
主要风险上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价

安装与使用

此项目未提供 Docker 镜像,安装步骤以原仓库 README 为准(涉及依赖安装与环境配置,对新手门槛较高)。