加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby – 变异测试:有人知道突变体吗?

发布时间:2020-12-17 02:34:40 所属栏目:百科 来源:网络整理
导读:昨天在这个 article的变异测试中偶然发现并且立即尝试了 elasticrepo一个lib我正在写入弹性搜索索引github. 不幸的是,我似乎错过了一些东西,因为我没有得到任何所谓的“杀死:rspec”和零突变: lsoave@ubuntu:~/rails/github/elasticrepo$mutant -I lib/ela
昨天在这个 article的变异测试中偶然发现并且立即尝试了 elasticrepo一个lib我正在写入弹性搜索索引github.

不幸的是,我似乎错过了一些东西,因为我没有得到任何所谓的“杀死:rspec”和零突变:

lsoave@ubuntu:~/rails/github/elasticrepo$mutant -I lib/elasticrepo -r repo_subset --rspec-dm2 ::RepoSubset
Mutant configuration:
Matcher:   #<Mutant::Matcher::ObjectSpace scope_name_pattern=/ARepoSubset(z|::)/>
Filter:    Mutant::Mutation::Filter::ALL
Strategy:  #<Mutant::Strategy::Rspec::DM2>

subjects:   0
mutations:  0
noop_fails: 0
kills:      0
alive:      0
mtime:      0.00s
rtime:      0.01s
lsoave@ubuntu:~/rails/github/elasticrepo$

现在我认为它可能与路径有关,然后在这种情况下:

lsoave@ubuntu:~/rails/github/elasticrepo$ls -l lib/elasticrepo
total 16
-rw-rw-r-- 1 lsoave lsoave  333 Jun  8 16:07 extractor.rb
-rw-rw-r-- 1 lsoave lsoave 1960 Jun  8 16:07 indexer.rb
-rw-rw-r-- 1 lsoave lsoave 1330 Jun  8 16:07 repo_subset.rb
-rw-rw-r-- 1 lsoave lsoave   43 Jun  1 12:28 version.rb
lsoave@ubuntu:~/rails/github/elasticrepo$

这里是要测试的类的“结构”(就命名空间而言):

lsoave@ubuntu:~/rails/github/elasticrepo$head -2 lib/elasticrepo/repo_subset.rb
module Elasticrepo
  class RepoSubset
lsoave@ubuntu:~/rails/github/elasticrepo$

请随意查看整个代码以测试突变:elasticrepo

由于响应行,正则表达式也可能出现问题:

Matcher:   #<Mutant::Matcher::ObjectSpace scope_name_pattern=/ARepoSubset(z|::)/>

任何人都可以帮忙吗?

解决方法

免责声明:突变的作者在这里.

刚克隆你的回购.需要改变:

>突变体目前仅在mri-1.9.3和rbx 19-模式下运行.我很快就会把它移植到2.0.0.
>指定完全限定的常量名称:: Elasticrepo :: RepoSubset而不是:: RepoSubset
>另请注意,对于当前的突变体版本,标志–rspec-dm2被简单地替换为–use rspec

Mutant确实可以正确运行此更改.

快乐变异!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读