我正在升级一个旧的应用程序,它有 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
申请详情: 春季启动2.7 Junit 4 和 5 测试 Java 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
你好吗? 本周我用 Junit 5 测试了 Pitest,效果很好。这里是repo: 我希望这可以帮助你