1

I'm currently trying PITest and so far it works properly. However, it is quite slow and the only solution so far is to use incremental analysis which potentially will solve the slowness. I've tried to set it as it's described in the documentation. Here is my configuration:

 <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>

However, in practise I don't see PITest taking historyInput and historyOutput into account and instead in the logs I'm seeing

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

I've tried plenty of different settings and none of them seem to work. Is there anything I'm missing?

Update

In the end, it turns out that the plugin definition was coming from the parent-pom and overriding it is partially possible in the inheriting child-pom.

Ducaz035
  • 3,054
  • 2
  • 25
  • 45

1 Answers1

1

There config you have posted works correctly.

You would only see the message

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

If you had also set withHistoryto true.

There looks to be a bug which stops things working if both are set. This needs to be fixed, but setting both doesn't really make sense.

withHistory is a convenience flag that sets both the in and outfile to point at a location in the temp dir.

The in/out file parameters are for when more fine grained control is needed (e.g the input file is being shared across a team).

So either set witHistory or set the history files explicitly, don't do both.

henry
  • 5,923
  • 29
  • 46
  • I don't have that property set to true, I've read about it on the forums somewhere. Still my problems continues. Essentially I want to have that hash file generated and that I can commit and share it via version control but couldn't manage to have it somewhere that I can configure. I'm using the latest version of the PITest as well and still wondering why it doesn't work for me because It should :D – Ducaz035 Mar 09 '19 at 13:49
  • The info message you posted is only ever shown if withHistory is set to true. If it is not set anywhere in the pom perhaps you are setting it on the command line when you execute? – henry Mar 09 '19 at 14:21
  • I don't have it set and from command line, I execute "mvn clean install" – Ducaz035 Mar 09 '19 at 17:19
  • Okay I guess I found the issue for me at least, I have a plugin declaration for PITest in the parent pom. I've always assumed declaration in the child pom would override it but clearly it doesn't. Do you think it is a bug in your side? I'd say so. – Ducaz035 Mar 09 '19 at 17:22
  • The way in which configuration values are inherited and resolved is standard maven behaviour over which the pitest plugin has no control. – henry Mar 10 '19 at 16:39
  • Okay then thank you, I'll accept yours as an answer. – Ducaz035 Mar 11 '19 at 08:01