Pitest failing after JUnit5 migration

144 views
Skip to first unread message

Harmesh Choubisa

unread,
Aug 15, 2021, 3:03:15 PM8/15/21
to PIT Users
It appears after JUnit5 migration integration test are failing. It was working before with JUnit 4.

Below is the configuration in pom

<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>1.6.8</version>
<dependencies>
<dependency>
<groupId>org.pitest</groupId>
<artifactId>pitest-junit5-plugin</artifactId>
<version>0.14</version>
</dependency>
</dependencies>
<configuration>
<targetClasses>
<param>com.abc.def.*</param>
</targetClasses>
<targetTests>
<param>com.abc.def.*</param>
</targetTests>
<timestampedReports>false</timestampedReports>
<threads>4</threads>
<outputFormats>
<outputFormat>XML</outputFormat>
<outputFormat>HTML</outputFormat>
</outputFormats>
</configuration>
</plugin>

TestSnippet:

@Test
public void getAllServices) {
givenApplicationStarted()
.when()
.contentType(APPLICATION_JSON)
.get("/context-root/services")
.then()
.statusCode(200);



Error logs

 8:56:53 PM PIT >> SEVERE : Description [testClass=com.abc.def.MyIntegrationTestIT, name=getAllServices()]
8:56:53 PM PIT >> INFO : MINION : java.lang.AssertionError: 1 expectation failed.
8:56:53 PM PIT >> INFO : MINION : Expected status code <200> but was <500>.


Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.pitest:pitest-maven:1.6.8:mutationCoverage failed: 3 tests did not pass without mutation when calculating line coverage. Mutation testing requires a green suite.
See http://pitest.org for more details.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject 


Regards,
Harmesh Choubisa

Reply all
Reply to author
Forward
0 new messages