'PIT Coverage generation minion exited abnormally

i see the following stacktrace when running the pitest gradle task in my project after adding all the required configurations in build.gradle. Can you please help me on this ? I'm using 1.5.1 version of the plugin.

The changes have been done in build.gradle as per the instructions in https://github.com/szpak/gradle-pitest-plugin

7:00:32 PM PIT >> INFO : Verbose logging is disabled. If you encounter a problem, please enable it before reporting an issue.
    7:00:33 PM PIT >> INFO : Sending 46 test classes to minion
    7:00:33 PM PIT >> INFO : Sent tests to minion
    7:00:33 PM PIT >> SEVERE : Error generating coverage. Please check that your classpath contains modern JUnit 4 or PIT test plugin for other test tool (JUnit 5, TestNG, ...) is enabled.
    Exception in thread "main" org.pitest.util.PitError: Coverage generation minion exited abnormally. Please check the classpath and/or enable test plugin for used test tool.

Please copy and paste the information and the complete stacktrace below when reporting an issue
VM : OpenJDK 64-Bit Server VM
Vendor : Private Build
Version : 25.252-b09
Uptime : 1723
Input -> 
 1 : -Dfile.encoding=UTF-8
 2 : -Duser.country=US
 3 : -Duser.language=en
 4 : -Duser.variant
BootClassPathSupported : true


Please copy and paste the information and the complete stacktrace below when reporting an issue
VM : OpenJDK 64-Bit Server VM
Vendor : Private Build
Version : 25.252-b09
Uptime : 1724
Input -> 
 1 : -Dfile.encoding=UTF-8
 2 : -Duser.country=US
 3 : -Duser.language=en
 4 : -Duser.variant
BootClassPathSupported : true

        at org.pitest.util.Unchecked.translateCheckedException(Unchecked.java:20)
        at org.pitest.coverage.execute.DefaultCoverageGenerator.calculateCoverage(DefaultCoverageGenerator.java:105)
        at org.pitest.coverage.execute.DefaultCoverageGenerator.calculateCoverage(DefaultCoverageGenerator.java:51)
        at org.pitest.mutationtest.tooling.MutationCoverage.runReport(MutationCoverage.java:115)
        at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:121)
        at org.pitest.mutationtest.tooling.EntryPoint.execute(EntryPoint.java:51)
        at org.pitest.mutationtest.commandline.MutationCoverageReport.runReport(MutationCoverageReport.java:87)
        at org.pitest.mutationtest.commandline.MutationCoverageReport.main(MutationCoverageReport.java:45)
Caused by: org.pitest.util.PitError: Coverage generation minion exited abnormally. Please check the classpath and/or enable test plugin for used test tool.

Please copy and paste the information and the complete stacktrace below when reporting an issue
VM : OpenJDK 64-Bit Server VM
Vendor : Private Build
Version : 25.252-b09
Uptime : 1723
Input -> 
 1 : -Dfile.encoding=UTF-8
 2 : -Duser.country=US
 3 : -Duser.language=en
 4 : -Duser.variant
BootClassPathSupported : true

        at org.pitest.coverage.execute.DefaultCoverageGenerator.gatherCoverageData(DefaultCoverageGenerator.java:143)
        at org.pitest.coverage.execute.DefaultCoverageGenerator.calculateCoverage(DefaultCoverageGenerator.java:89)
        ... 6 more

FAILURE: Build failed with an exception.


Solution 1:[1]

As per the error message, you do not have the pitest junit 5 plugin enabled.

If you add

junit5PluginVersion = '0.12'

To the configuration the plugin will be enabled and the tests should be picked up.

Solution 2:[2]

The thing is that the latest version of PIT uses JUnit5, and I was using JUnit4. So, I solved it by migrating to JUnit5

if you are using maven, add the following lines to your pom file:

  <properties>
    <junit.jupiter.version>5.8.1</junit.jupiter.version>
    <junit.platform.version>1.8.1</junit.platform.version>
  </properties>
  
  <dependencies>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>${junit.jupiter.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>${junit.jupiter.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-params</artifactId>
        <version>${junit.jupiter.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.platform</groupId>
        <artifactId>junit-platform-suite</artifactId>
        <version>${junit.platform.version}</version>
        <scope>test</scope>
    </dependency>

</dependencies>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 henry
Solution 2 Aleja Duque-Torres