我的 pom 文件中有以下内容:
pom.xml
<reporting>
<plugins>
<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>1.1.8</version>
<configuration>
<targetClasses>
<param>com.myService.utility.*</param>
</targetClasses>
<reportsDirectory>/my-service/target</reportsDirectory>
<targetTests>
<param>com.myService.utility.util.*</param>
</targetTests>
<timeoutConstant>5000</timeoutConstant>
<excludeClasses>
<param>com.myService.utility.EmailImpl.java</param>
<param>com.myService.utility.Email.java</param>
<param>com.myService.utility.ValidationUtil.java.java</param>
</excludeClasses>
<avoidCallsTo>
<avoidCallsTo>org.apache.log4j</avoidCallsTo>
<avoidCallsTo>org.slf4j</avoidCallsTo>
<avoidCallsTo>org.apache.commons.logging</avoidCallsTo>
</avoidCallsTo>
</configuration>
<reportSets>
<reportSet>
<reports>
<report>report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
当我运行测试时,超时似乎没有从默认的 3000 改变,excludeClasses 中的类仍然被拾取,并且它仍然抱怨 log4j 的配置(虽然它是 log4j2 所以这看起来像是我的错指定)。我在 PITest 文档或其他任何地方都找不到很多示例,除了使用 targetClasses 和 targetTests 的非常简单的示例
编辑:我尝试将报告标签更改为构建标签并删除了 reportSets 部分。仍然没有变化;实用程序 src 包包含 6 个类,其中我在 pom 中概述的 3 个应排除在外,并且在 test 对应包中有 3 个测试文件。记者仍在拉入要排除的类,并显示为 0% 行和突变覆盖率。尽管具有 AvoidCallsTo 值,但它也抱怨 log4j 配置