我将 PIT Mutation Test 用于一个巨大的 java 程序(超过 450.000 LOC)。它全部分离为com.myProgramm.TheNormalClasses
和com.myProgramm.TheNormalClasses.Test
。所以我把我pom.xml
的改成com.myProgramm.TheNormalClasses.Test
这样:
<build>
<plugins>
<!-- START MUTATIONTEST TOOL -->
<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>1.4.11</version>
<configuration>
<targetClasses>
<param>com.myProgramm.TheNormalClasses.*</param>
</targetClasses>
<targetTests>
<param>ccom.myProgramm.TheNormalClasses.*</param>
</targetTests>
</configuration>
<executions>
<execution>
<id>pit-report</id>
<goals>
<goal>mutationCoverage</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- END MUTATIONTEST TOOL -->
</plugins>
</build>
那时我删除了配置标签,然后我的 Pit Test 找到了 0 个测试类来挖掘。将配置标签添加到我的类后,它会找到 5 个测试类,但不会使用它们。这是我的输出:
[INFO] --- pitest-maven:1.4.11:mutationCoverage (pit-report) @ com.myProgramm.TheNormalClasses.Test ---
[INFO] Found plugin : Default csv report plugin
[INFO] Found plugin : Default xml report plugin
[INFO] Found plugin : Default html report plugin
[INFO] Found plugin : Static initializer code detector plugin
[INFO] Found plugin : Static initializer filter plugin
[INFO] Found plugin : Excluded annotations plugin
[INFO] Found plugin : Try with resources filter
[INFO] Found plugin : Inlined finally block filter plugin
[INFO] Found plugin : Implicit null check filter
[INFO] Found plugin : Method reference null check filter
[INFO] Found plugin : For each loop filter
[INFO] Found plugin : Logging calls filter
[INFO] Found plugin : Infinite for loop filter
[INFO] Found plugin : Long running iterator loop filter
[INFO] Found plugin : For loop counter filter
[INFO] Found plugin : Kotlin junk mutations filter
[INFO] Found plugin : Max mutations per class limit
[INFO] Found plugin : Equals shortcut equivalent mutant filter
[INFO] Found plugin : Trivial return vals equivalence filter
[INFO] Found plugin : Mutant export plugin
[INFO] Found shared classpath plugin : Default mutation engine
[INFO] Found shared classpath plugin : JUnit plugin
[INFO] Found shared classpath plugin : TestNG plugin
[INFO] Adding org.pitest:pitest to SUT classpath
[INFO] Mutating from C:\MyProgram\com.myProgramm.TheNormalClasses.Test\target\classes
19:55:00 PIT >> INFO : Verbose logging is disabled. If you encounter a problem, please enable it before reporting an issue.
19:55:01 PIT >> INFO : Sending 1 test classes to minion
19:55:01 PIT >> INFO : Sent tests to minion
19:55:01 PIT >> INFO : MINION : 19:55:01 PIT >> INFO : Checking environment
19:55:01 PIT >> INFO : MINION : 19:55:01 PIT >> INFO : Found 5 tests
19:55:01 PIT >> INFO : MINION : 19:55:01 PIT >> INFO : Dependency analysis reduced number of potential tests by 0
19:55:01 PIT >> INFO : MINION : 19:55:01 PIT >> INFO : 5 tests received
/19:55:02 PIT >> INFO : Calculated coverage in 1 seconds.
19:55:02 PIT >> INFO : Created 0 mutation test units
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.475 s
[INFO] Finished at: 2020-03-29T19:55:02+02:00
[INFO] Final Memory: 56M/639M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.pitest:pitest-maven:1.4.11:mutationCoverage (pit-report) on project com.myProgramm.TheNormalClasses.Test: Execution pit-report of goal org.pitest:pitest-maven:1.4.11:mutationCoverage failed: No mutations found. This probably means there is an issue with either the supplied classpath or filters.
[ERROR] See http://pitest.org for more details.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
那么,这个错误信息是什么?我不明白这个问题。我以前从未在其他 Java 程序中遇到过这种情况,其中测试在同一个包中,但只在不同的文件夹中:src 和测试
我现在该怎么办?