1

我目前正在尝试 PITest,到目前为止它工作正常。但是,它非常慢,到目前为止唯一的解决方案是使用增量分析,这可能会解决缓慢的问题。我试图按照文档中的描述进行设置。这是我的配置:

 <build>
<plugins>
  <plugin>
    <executions>
      <execution>
        <id>pitest-mutation-coverage</id>
        <goals>
          <goal>mutationCoverage</goal>
        </goals>
      </execution>
    </executions>
    <groupId>org.pitest</groupId>
    <artifactId>pitest-maven</artifactId>
    <version>1.4.6</version>
    <configuration>
      <threads>8</threads>
      <timestampedReports>false</timestampedReports>
      <historyInputFile>${project.basedir}/pitest.history</historyInputFile>
      <historyOutputFile>${project.basedir}/pitest.history</historyOutputFile>
      <avoidCallsTo>
        <avoidCallsTo>java.util.logging</avoidCallsTo>
        <avoidCallsTo>org.slf4j</avoidCallsTo>
      </avoidCallsTo>
      <mutators>
        <mutator>DEFAULTS</mutator>
      </mutators>
    </configuration>
  </plugin>
</plugins>

但是,在实践中,我没有看到 PITest 将 historyInput 和 historyOutput 考虑在内,而是在我看到的日志中

[INFO] Will read and write history at /var/folders/x1/qp5hhks571q0drb7kd7vjn0c0000gn/T/my.module.groupId.artifactId.version_pitest_history.bin

我尝试了很多不同的设置,但它们似乎都不起作用。有什么我想念的吗?

更新

最后,事实证明插件定义来自 parent-pom,并且在继承的 child-pom 中覆盖它是部分可能的。

4

1 回答 1

1

您发布的配置可以正常工作。

你只会看到消息

[INFO] Will read and write history at /var/folders/x1/qp5hhks571q0drb7kd7vjn0c0000gn/T/my.module.groupId.artifactId.version_pitest_history.bin

如果你设置withHistory为true。

如果两者都设置了,似乎有一个错误会停止工作。这需要修复,但同时设置两者并没有什么意义。

withHistory是一个方便标志,将 in 和 outfile 都设置为指向临时目录中的某个位置。

输入/输出文件参数用于需要更细粒度的控制(例如,输入文件在团队之间共享)。

因此,无论是witHistory明确设置还是设置历史文件,都不要两者都做。

于 2019-03-09T13:41:34.253 回答