【问题标题】:How to pass in arguments to mutant-rspec?如何将参数传递给mutant-rspec?
【发布时间】:2021-01-13 13:48:00
【问题描述】:

我正在尝试在具有以下目录结构的项目中使用mutant-rspec 库

app
  backend
    spec
      someclass_spec.rb
    src
      someclass.rb
  frontend

我想看看我在 someclass_spec.rb 上的测试覆盖率有多好,但似乎无法弄清楚要传递什么。我相当确定(根据阅读,我需要 --include src,但是我终其一生都无法弄清楚 --require 参数中包含什么内容。

从后端文件夹,我试过了...

bundle exec mutant --use rspec
bundle exec mutant --include src --use rspec 
bundle exec mutant --include src --require someclass --use rspec
bundle exec mutant --include src --require src/someclass --use rspec
bundle exec mutant --include src --require src/someclass.rb --use rspec
bundle exec mutant --include src --require someclass.rb --use rspec
bundle exec mutant --include src --require Someclass --use rspec

但我从来没有设法获得任何活跃的主题

Active subjects: 0
Mutant configuration:
Matcher:         #<Mutant::Matcher::Config empty>
Integration:     Mutant::Integration::Rspec
Jobs:            4
Includes:        []
Requires:        []
Subjects:        0
Mutations:       0
Results:         0
Kills:           0
Alive:           0
Runtime:         0.06s
Killtime:        0.00s
Overhead:        Inf%
Mutations/s:     0.00
Coverage:        100.00%

我可以将什么传递给标志以使其在我的 someclass.rb 文件上运行? 不幸的是,文档在这方面似乎不是很清楚。

【问题讨论】:

    标签: ruby rspec mutation mutation-testing


    【解决方案1】:

    根据我在Matcher: #&lt;Mutant::Matcher::Config empty&gt; 中看到的内容,您可能缺少作为最后一个参数的突变主题。如果你的主题是Someclass,那就是:

    bundle exec mutant --include src --require someclass --use rspec Someclass
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多