Pitest 插件未检测到 junit5 依赖项

Pitest plugin is not detecting junit5 dependency

提问人:BarbetNL 提问时间:9/19/2023 更新时间:11/3/2023 访问量:133

问:

我正在升级一个旧应用程序,它有 pitest 插件来改进单元测试。一些较新的测试是 junit 5,所以我添加了 junit5 插件。但是,当我运行测试时,它没有检测到插件。我错过了什么?

我的POM插件:

    <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>

我使用以下命令运行测试:

mvn 测试编译 org.pitest:pitest-maven:mutationCoverage

应用详情: Spring Boot 2.7 (英语) Junit 4 和 5 测试 爪哇 11

我得到的消息:

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.

来自异常的其他信息:

[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
spring-boot junit junit4 junit5 pitest

评论

0赞 henry 9/20/2023
如果您使用最新版本的插件 (1.2.0) 会发生什么?
0赞 BarbetNL 9/20/2023
没有解决问题。还是同样的问题。

答: 暂无答案