Mutation testing: does anyone know a mutant?

Yesterday I stumbled in this article about mutation testing and immediately tried elasticrepo a I am writing to index github on elasticsearch.

Unfurtunatly it seems that I am missing something because I am not getting the 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 that this may 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 is the "structure" of the class to check (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 use all the code to test the mutation: elasticrepo

It is also possible that something is wrong with the regex due to the response line:

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

Can anyone help with this?

+4
source share
1 answer

Disclaimer: The author of the mutant is here.

Just cloned your repo. Necessary changes:

  • Mutant currently only works in mri-1.9.3 and rbx 19 modes. I will ship it to 2.0.0 soon.
  • Specify the full name of the constant, ::Elasticrepo::RepoSubset instead of ::RepoSubset
  • Also note that for current mutant releases, the --rspec-dm2 flag --rspec-dm2 been replaced simply by --use rspec

Mutant works correctly with these changes.

Happy mutations!

+4
source

Source: https://habr.com/ru/post/1485252/


All Articles