Facing (Kill ratio is NaN% (0 0)) Issue when running Mutation test pittest in Jenkins

238 views Asked by At

Hi we recently migrated from java 11 to java 17 after migration, We are facing following Issue when running MutationTest in Jenkins

Kill ratio is NaN% (0 0) when we run in Jenkins

<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>1.11.0</version>
<dependencies>
<dependency>
<groupId>org.pitest</groupId>
<artifactId>pitest-junit5-plugin</artifactId>
<version>1.1.2</version>
</dependency>
</dependencies>
<configuration>
<argLine>
--add-opens java.base/java.lang=ALL-UNNAMED
</argLine> 
</configuration> 
</plugin>

dependency We have used

  • Jenkins Plugin - pitmutation:1.0-18
  • pitest-maven: 1.11.0
  • pitest-junit5-plugin: 1.1.2

We Initially Tried with the following version but got same issue

  • Jenkins Plugin - pitmutation:1.0-18
  • pitest-maven: 1.14.2
  • pitest-junit5-plugin: 1.2.0

We also Tried with the following version but got same issue

  • Jenkins Plugin - pitmutation:1.0-18
  • pitest-maven: 1.13.2
  • pitest-junit5-plugin: 1.0.0

but still we got same issue?

In local in target folder i am able to view html file which reports coverage

In Jenkins we are able to get following

2023-07-17 14:56:31.635  >> Line Coverage: 858/1021 (84%)
2023-07-17 14:56:31.635  >> Generated 280 mutations Killed 203 (73%)
2023-07-17 14:56:31.635  >> Mutations with no coverage 52. Test strength 89%
2023-07-17 14:56:31.635  >> Ran 251 tests (0.9 tests per mutation)
2023-07-17 14:56:31.635  Enhanced functionality available at https://www.arcmutate.com/

but we get Kill ratio is NaN% (0 0) and pit report section no 0,0

2

There are 2 answers

0
Nisarg Bhagavantanavar On BEST ANSWER

Hi All issue was with version of Jenkins plugin installed in our jenkins - if you have admin access to the Jenkins you can verify the plugin version installed

https://plugins.jenkins.io/pitmutation/releases/

as you can see the from above link, Those plugin version (latest 1.0-18) is not compatible with latest pitest-maven:1.14.0

so downgraded to pitest-maven:1.7.3 and junit5 plugin to 0.15 then it started working refer the snip attached

compatibility

pom file: enter image description here

0
Gleb Nebolyubov On

The problem is that the newer versions of pitest-maven have some tags in the xml that are not supported by the the jenkins plugin.

Following the suggestion from https://issues.jenkins.io/browse/JENKINS-68990 solved the issue for me.

In my case I had a multi module project, so the "fixing" code looks like this:

find . -iname mutations.xml | xargs sed -i -E -e 's#</?(blocks|indexes)>##g'

my stack:

  • Jenkins Plugin - pitmutation:1.0-18
  • pitest-maven: 1.15.8
  • pitest-junit5-plugin: 1.2.1

Important thing to notice for anyone who will try to run a mutli module project - there is another problem showing the module names, as described here https://issues.jenkins.io/browse/JENKINS-70363