Pitest plugin is not detecting junit5 dependency

661 views Asked by At

I'm upgrading an old application and it has the pitest plugin to improve the unit testing. Some newer tests are junit 5, so I added the junit5 plugin. However when I run the tests, it does not detect the plugin. What am I missing?

My POM plugin in :

    <build>
    <plugins>
        <plugin>
            <groupId>org.pitest</groupId>
            <artifactId>pitest-maven</artifactId>
            <version>1.14.4</version>
            <dependencies>
                <dependency>
                    <groupId>org.pitest</groupId>
                    <artifactId>pitest-junit5-plugin</artifactId>
                    <version>1.1.1</version>
                </dependency>
            </dependencies>
            <configuration>
                <targetClasses>
                    <param>nl.proj.proj*</param>
                </targetClasses>
                <targetTests>
                    <param>nl.proj.proj*</param>
                </targetTests>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>11</source>
                <target>11</target>
            </configuration>
        </plugin>

    </plugins>
</build>

I run the tests with the command:

mvn test-compile org.pitest:pitest-maven:mutationCoverage

Application details: Spring boot 2.7 Junit 4 & 5 tests Java 11

The message I get:

13:19:49 PIT >> WARNING : JUnit 5 is on the classpath but the pitest junit 5 plugin is not installed (https://github.com/pitest/pitest-junit5-plugin)
13:19:49 PIT >> INFO : Created 24 mutation test units in pre scan
13:19:49 PIT >> INFO : Sending 31 test classes to minion
13:19:49 PIT >> INFO : Sent tests to minion
13:19:49 PIT >> SEVERE : Pitest could not run any tests. Please check that you have installed the pitest plugin for your testing library (eg JUnit 5, TestNG). If your project uses JUnit 4 the plugin is automatically included, but a recent version of JUnit 4 must be on the classpath.

Additional information from the exception:

[ERROR] Please copy and paste the information and the complete stacktrace below when reporting an issue
[ERROR] VM : OpenJDK 64-Bit Server VM
[ERROR] Vendor : Eclipse Adoptium
[ERROR] Version : 11.0.18+10
[ERROR] Uptime : 10828
[ERROR] Input -> 
[ERROR]  1 : -Dclassworlds.conf=/opt/homebrew/Cellar/maven/3.9.1/libexec/bin/m2.conf
[ERROR]  2 : -Dmaven.home=/opt/homebrew/Cellar/maven/3.9.1/libexec
[ERROR]  3 : -Dlibrary.jansi.path=/opt/homebrew/Cellar/maven/3.9.1/libexec/lib/jansi-native
[ERROR]  4 : -Dmaven.multiModuleProjectDirectory=/Users/riekele/IdeaProjects/rass-idin-idb
[ERROR] BootClassPathSupported : false
0

There are 0 answers