1

我正在尝试从命令行运行 maven 构建并排除 PITest 运行任何突变。目前报告失败,我们需要能够提供一个参数来忽略运行突变测试或忽略结果并继续构建

我已经运行了一些参数,例如mvn package -Dpit.report=true

或者mvn package -Dmaven.report.skip=true

这是我的 pom 中的 PITest 设置

<plugin>
    <groupId>org.pitest</groupId>
    <artifactId>pitest-maven</artifactId>
    <version>1.1.10</version>
    <configuration>
        <timestampedReports>false</timestampedReports>
        <mutationThreshold>95</mutationThreshold>
    </configuration>
    <executions>
        <execution>
            <id>report</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>mutationCoverage</goal>
            </goals>
        </execution>
    </executions>
</plugin>

问题是它仍在运行 PITest 并导致构建失败

4

3 回答 3

1

没有跳过插件执行的本地方法,但至少有两种解决方法:

  • 首先,添加一个属性来覆盖执行阶段

定义一个pitPhase具有默认值的属性作为插件执行的默认阶段。

然后在插件配置中:

<execution>
   <phase>${pitPhase}</phase>
   ...
</execution>

之后,当您想跳过执行时mvn -DskipPit=pitPhase package

于 2019-09-26T16:11:09.547 回答
0

在 Maven 中可以跳过 Pitests 的执行。

在你的 pom.xml 中:

  1. 在一般属性中设置:

<properties> 
       <pitest.execution.skip>true</pitest.execution.skip> 
</properties>
  1. 在插件中设置:
 <plugin>
         <groupId>org.pitest</groupId>
         <artifactId>pitest-maven</artifactId>
         <version>Your_Version</version>
         <configuration>
            <skip>${pitest.execution.skip}</skip>
         </configuration>
 </plugin>
于 2021-03-12T11:28:04.490 回答
0

从 1.4.11 开始有选项skipPitest。见这里:https ://github.com/hcoles/pitest/releases/tag/pitest-parent-1.4.11

所以你也是:-DskipPitest

于 2021-10-07T12:30:21.153 回答