Search code examples
javamutation-testingpitest

pitest report can't mix JUnit 4 and JUnit 5 tests


Recently, I introduced Pitest as the mutation testing tool to our team to diagnose test quality, and we loved it.

In our codebase, we have lots of preexisting JUnit 4, and now we're writing all of our new unit tests in JUnit 5. Unfortunately, even after adding Pitest JUnit 5 plugin when we try to run the mutation testing goal mvn org.pitest:pitest-maven:mutationCoverage, and it only picks up JUnit 4 tests and ignores JUnit 5 tests.

We want our report to contain JUnit 4 and 5 tests. Is there a way(hack) to generate a report mixed with JUnit 4 and 5?


Solution

  • As pointed by henry's comment, I fixed the issue by upgrading to the latest version of pitest. These versions worked for me:

                <plugin>
                    <groupId>org.pitest</groupId>
                    <artifactId>pitest-maven</artifactId>
                    <version>1.7.1</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.pitest</groupId>
                            <artifactId>pitest-junit5-plugin</artifactId>
                            <version>0.14</version>
                        </dependency>
                    </dependencies>
                </plugin>