8

How should i get rid of this warning and add the timeout constant for pitest?

My command is:

mvn jacoco:report org.pitest:pitest-maven:mutationCoverage sonar:sonar -Dpitest.timeoutConst=8000

But it throws: WARNING : Slave exited abnormally due to TIMED_OUT

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Sunil Gulabani
  • 878
  • 1
  • 8
  • 21
  • There is nothing to worry about, can you verify the generated report : if the mutations marked as timed out don't look like infinite loops to you try a larger value for the timeout const, but this may slow down the process by causing a longer wait each time an infinite loop is encountered. – Abdelghani Roussi Apr 15 '16 at 08:24
  • Already checked this comment - https://groups.google.com/forum/#!topic/pitusers/RFKOYSLmQ6o – Sunil Gulabani Apr 15 '16 at 09:26

1 Answers1

12

It is unlikely that you will be able to get rid of all the warnings - they are generated when a mutation creates an infinite loop.

Pitest detects these by comparing the execution time of each test with the time it took when no mutation is present. If the test takes significantly more time to run then the process is killed and the mutation marked as timed out.

The reason pitest reports a warning is in case it is being too hasty in marking a mutation as an infnite loop - it might be that things are running a bit slowly for other reasons.

If you have a lot of timeouts the first thing to do is examine the report and see if they all look like legitimate infinite loops. If they do then there is nothing more to be done.

Iff some of the timeouts do not look like infinite loops then you can try increasing the timeout constant.

This can be set in the pom, or passed on the commandline. It should not be prefixed with pitest.

mvn org.pitest:pitest-maven:mutationCoverage -DtimeoutConstant=8000

henry
  • 5,923
  • 29
  • 46
  • 2
    I'm not sure if this was changed or a typo in the original answer, but with a more recent version of the pitest plugin (1.2.3), you need a slightly different spelling of the paramter. You'll need to use -DtimeoutConstant=8000 now – Evert Oct 10 '17 at 15:11
  • @Evert I believe you are correct. I am using 1.4.3 and changing from timeoutConst to timeoutConstant worked for me – Bradley D Oct 18 '18 at 21:48
  • 2
    @henry How can I find those timed-out tests? Clicking them all in the report one by one? – Nikem May 24 '19 at 12:12
  • -DtimeoutFactor=1.5 also an option, where the default value is 1.25 – Rajat Apr 17 '22 at 11:03