質問

Yesterday a stumble in this article on Mutation Testing and immediatly had a try with elasticrepo a lib I'm writing to index github on elasticsearch.

Unfurtunatly it seems I'm missing something, because I don't get any so called "Killed: rspec" and zero mutations:

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$ 

now I think it could be related to the path and then here they are in this case :

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$ 

and here it is the "structure" of the class to test ( in terms of namespace ):

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

Please feel free to se the entire code to test for mutation: elasticrepo

It's also possible something goes wrong with regex because of the responce line :

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

Can anyone help on this ?

役に立ちましたか?

解決

Disclaimer: Author of mutant here.

Just cloned your repo. Changes needed:

  • Mutant currently only runs under mri-1.9.3 and rbx 19-mode. I'll port it to 2.0.0 soon.
  • Specify the fully qualified constant name, ::Elasticrepo::RepoSubset instead of ::RepoSubset
  • Also note that for current mutant releases the flag --rspec-dm2 was replaced with simply --use rspec

Mutant does run correctly with this changes.

Happy mutating!

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top