I have a strange problem here for which I could not find the reason:
When using pitest with maven (and java 11) on the commandline it works as expected, but when running it on the Jenkins-Server via declarative pipeline it results in an error.
Part from my maven pom:
<build>
<plugins>
<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>1.4.8</version>
<dependencies>
<dependency>
<groupId>org.pitest</groupId>
<artifactId>pitest-junit5-plugin</artifactId>
<version>0.8</version>
</dependency>
</dependencies>
<configuration>
<verbose>true</verbose>
</configuration>
</plugin>
</plugins>
</build>
Part from my Jenkinsfile:
stage('MutationTesting')
{
steps
{
bat 'mvn --batch-mode org.pitest:pitest-maven:mutationCoverage'
}
}
Before that the following maven commands will be called from the pipeline:
mvn --batch-mode clean
mvn --batch-mode compile
mvn --batch-mode compiler:testCompile surefire:test -Dmaven.test.failure.ignore=true
When calling exactly these commands on the commandline then pitest works perfectly.
When comparing the logging results, then they are nearly equal.
Log output from commandline:
PIT >> FINE : Maximum available memory is 3609 mb
PIT >> FINE : MINION : Installing PIT agent
PIT >> INFO : Sending 13 test classes to minion
PIT >> INFO : Sent tests to minion
PIT >> INFO : MINION : 08:51:20 PIT >> FINE : Expecting 13 tests classes from parent
PIT >> FINE : Tests classes received
PIT >> INFO : Checking environment
PIT >> INFO : MINION : 08:51:20 PIT >> INFO : Found 1 tests
PIT >> INFO : MINION : 08:51:20 PIT >> INFO : Dependency analysis reduced number of potential tests by 0
PIT >> INFO : MINION : 08:51:20 PIT >> INFO : 1 tests received
PIT >> INFO : MINION : 08:51:20 PIT >> FINE : Running 1 units
PIT >> INFO : MINION : 08:51:20 PIT >> FINE : Gathering coverage for test Description [testClass=de.test.Tests, name=creation()]
PIT >> FINE : Coverage generator Minion exited ok
PIT >> INFO : Calculated coverage in 0 seconds.
PIT >> FINE : Used memory after coverage calculation 42 mb
PIT >> FINE : Free Memory after coverage calculation 201 mb
[... Mutations output cut]
Log output from Jenkins-Pipeline:
PIT >> FINE : Maximum available memory is 1813 mb
PIT >> FINE : MINION : Installing PIT agent
PIT >> INFO : Sending 13 test classes to minion
PIT >> INFO : Sent tests to minion
PIT >> INFO : MINION : 08:46:28 PIT >> FINE : Expecting 13 tests classes from parent
PIT >> FINE : Tests classes received
PIT >> INFO : Checking environment
PIT >> INFO : MINION : 08:46:29 PIT >> INFO : Found 1 tests
PIT >> INFO : MINION : 08:46:29 PIT >> INFO : Dependency analysis reduced number of potential tests by 0
PIT >> INFO : MINION : 08:46:29 PIT >> INFO : 1 tests received
PIT >> INFO : MINION : 08:46:29 PIT >> FINE : Running 1 units
PIT >> INFO : MINION : 08:46:29 PIT >> FINE : Gathering coverage for test Description [testClass=de.test.Tests, name=creation()]
PIT >> FINE : Coverage generator Minion exited ok PIT >> INFO : Calculated coverage in 1 seconds. PIT >> FINE : Used memory after coverage calculation 43 mb PIT >> FINE : Free Memory after coverage calculation 177 mb PIT >> INFO : Created 0 mutation test units [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.644 s [INFO] Finished at: 2019-06-06T08:46:29+02:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.pitest:pitest-maven:1.4.8:mutationCoverage (default-cli) on project multiuploader: Execution default-cli of goal org.pitest:pitest-maven:1.4.8:mutationCoverage failed: No mutations found. This probably means there is an issue with either the supplied classpath or filters. [ERROR] See http://pitest.org for more details.
So I could only assume that there is a difference in the environment - but which one? Or is it is a bug in pitest?