伙计们!我尝试在我的 Maven / Java 项目中使用 ptest-maven 插件,但它显然无法生成汇总报告(考虑到我有一个多模块项目)。我从官方网站和其他几个来源收集了一些信息,但是,它们都没有真正有助于为这种场景定义正确的配置。简而言之,我的结构如下所示:
父项目
- 孩子A
- 孩子B
- 孩子 ...
- 孩子 N
在某些子模块中,执行 pi-test 确实有意义,而其他子模块则没有。可以这么说,我的配置总体来说是。
父模块 pom:
<profile>
<id>run-pitest</id>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>1.3.2</version>
<configuration>
<outputFormats>
<param>HTML</param>
<param>XML</param>
</outputFormats>
<!--<historyInputFile>${project.basedir}/pitHistory.txt</historyInputFile>-->
<!--<historyOutputFile>${project.basedir}/pitHistory.txt</historyOutputFile>-->
<mutators>
<mutator>CONDITIONALS_BOUNDARY</mutator>
<mutator>MATH</mutator>
<mutator>INCREMENTS</mutator>
<mutator>NEGATE_CONDITIONALS</mutator>
</mutators>
<verbose>true</verbose>
<exportLineCoverage>true</exportLineCoverage>
<testPlugin>testng</testPlugin>
<!--<reportsDirectory>${project.build.directory}/pit-reports</reportsDirectory>-->
</configuration>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>mutationCoverage</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>site</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
</plugin>
</plugins>
</build>
</profile>
具有突变的子项目:
<plugins>
<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<configuration>
<mutationThreshold>80</mutationThreshold>
<exportLineCoverage>true</exportLineCoverage>
</configuration>
</plugin>
</plugins>
最后,当我尝试执行阶段 站点(如父项中定义的那样)时,即使我执行了创建文件(例如linecoverage.xml和mutation.xml的全新安装) ,我也会收到此错误:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.820 s
[INFO] Finished at: 2018-04-06T13:20:47+02:00
[INFO] Final Memory: 35M/514M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.pitest:pitest-maven:1.3.2:report-aggregate (report) on project my-parent: An error has occurred in PIT Test Report report generation. Failed to build: no lineCoverageFiles have been set -> [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.
...
如果我做了错误的配置,或者是否有更好的方法来完成此设置的任何部分,你们中的任何人都知道吗?