Infection: Hide killed mutants in output log?

Created on 19 Oct 2017  路  7Comments  路  Source: infection/infection

This library is nothing short of amazing. Thank you!

Is there an option to hide the killed mutants in the log? When I run it, I'm only interested in everything but killed mutants and I find the killed mutants list to be a bit noisy when scrolling to find what methods need attention.

Thanks again!

Feature Request Good First Issue / Easy Pick Has PR

Most helpful comment

After looking at my 17,371 line infection-log.txt with 1586 mutants...

My goal is to remove as many of these mutants as possible. I'm not particularly interested in killed mutants, especially since I can see them in the summary report while the test is running. When trying to kill a mutant I need the following information:

  • Filename (preferably the relative path)
  • Line number
  • Mutation type
  • Mutation

Here is an entry from one of my escaped mutations.

1) Infection\Mutator\FunctionSignature\PublicVisibility
/Users/eko3alpha/Local/myApp/app/core/Alert.php
exec /usr/local/php7.1.10-20171002-090111/bin/php /Users/eko3alpha/.composer/vendor/phpunit/phpunit/phpunit --configuration /var/folders/ts/00j0gp4s2s55x25bxn9l7dpr0000gn/T/infection/phpunitConfiguration.ab514bec1be05a8810f2e10fd8385f36.infection.xml --stop-on-failure 
--- Original
+++ New
@@ @@
-    public function getHeader()
+    protected function getHeader()

PHPUnit 6.4.3 by Sebastian Bergmann and contributors.

.                                                                   1 / 1 (100%)

Time: 174 ms, Memory: 4.00MB

OK (1 test, 1 assertion)

What I would like to see

1) /app/libraries/Alert.php:45    [M] PublicVisibility

    --- Original
    +++ New
    @@ @@
    -    public function getHeader()
    +    protected function getHeader()

or maybe even this shorter version

1) /app/libraries/Alert.php:45    [M] PublicVisibility

    -    public function getHeader()
    +    protected function getHeader()

This would make debugging more efficient, especially if you have hundreds of these to go through. I also noticed that only "not covered mutants" show a line number.

Hope this helps.

I said it once, but I'll say it again, this library is awesome. It found so many blind spots and I've only been using it two days!

All 7 comments

Hi, thank you for these kind words and for using Infection!

I'm afraid I didn't get you right. Do you mean you want to exclude information about Killed mutants from the infection-log.txt? If so, this is not possible at the moment.

Why is it noisy? Killed mutants are at the bottom of the file, after Escaped and Timeouts.

I can imagine that in a big project with thousands of mutants and a big MSI percentage those killed mutants just pollute the log file, so I'm ok with adding a new option to generate "lightweight" log file.

Any ideas on the naming of such option? Would you like to contribute?

@borNfreee what about simply "log-verbosity"?

@theofidry great suggestion 馃憤 . I like it because we can control not just types of mutants in the log, but also additional meta information like executed commands, diffs, process outputs, etc.

Just one question - what will be a default verbosity level for our logs? I would like to have a very verbose level defaulted since sometimes killed mutants are killed because of unexpected [fatal/environment] errors and IMO user should detect it as soon as possible. Is it ok to have such default verbosity level? (e.g. symfony has default verbosity level NONE)

I'm up for verbose mode by default, although it might be worth mentioning somewhere _why_. For some people fatal/environment errors are acceptable as well. I don't have an example on top of my head but I remember coming across this case a few times

I like the idea of verbosity, that would remove some of the noise in the log file. My goal with this suggestion is to quickly identify the file and line number so more tests can be added or code rewritten. The current log format is a firehose of information. For example, in my case, I'm mainly interested in the type of mutation (with example), file, and line number. I'll see if I can come up with some suggestions.

After looking at my 17,371 line infection-log.txt with 1586 mutants...

My goal is to remove as many of these mutants as possible. I'm not particularly interested in killed mutants, especially since I can see them in the summary report while the test is running. When trying to kill a mutant I need the following information:

  • Filename (preferably the relative path)
  • Line number
  • Mutation type
  • Mutation

Here is an entry from one of my escaped mutations.

1) Infection\Mutator\FunctionSignature\PublicVisibility
/Users/eko3alpha/Local/myApp/app/core/Alert.php
exec /usr/local/php7.1.10-20171002-090111/bin/php /Users/eko3alpha/.composer/vendor/phpunit/phpunit/phpunit --configuration /var/folders/ts/00j0gp4s2s55x25bxn9l7dpr0000gn/T/infection/phpunitConfiguration.ab514bec1be05a8810f2e10fd8385f36.infection.xml --stop-on-failure 
--- Original
+++ New
@@ @@
-    public function getHeader()
+    protected function getHeader()

PHPUnit 6.4.3 by Sebastian Bergmann and contributors.

.                                                                   1 / 1 (100%)

Time: 174 ms, Memory: 4.00MB

OK (1 test, 1 assertion)

What I would like to see

1) /app/libraries/Alert.php:45    [M] PublicVisibility

    --- Original
    +++ New
    @@ @@
    -    public function getHeader()
    +    protected function getHeader()

or maybe even this shorter version

1) /app/libraries/Alert.php:45    [M] PublicVisibility

    -    public function getHeader()
    +    protected function getHeader()

This would make debugging more efficient, especially if you have hundreds of these to go through. I also noticed that only "not covered mutants" show a line number.

Hope this helps.

I said it once, but I'll say it again, this library is awesome. It found so many blind spots and I've only been using it two days!

Implemented by @sidz in https://github.com/infection/infection/commit/18bb1d866baca816c73c2621ce8b5315b361ac5b

Will be released in 0.6.1 later

Was this page helpful?
0 / 5 - 0 ratings