1

<reporting>次のようにセクションを設定するとpom、確実なレポートのみが取得されますが、入力が見つからないため、ピテストレポートは失敗します。

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>2.9</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-report-plugin</artifactId>
        <version>2.19.1</version>
      </plugin>
      <plugin>
        <groupId>org.pitest</groupId>
        <artifactId>pitest-maven</artifactId>
        <version>1.1.10</version>
        <configuration>
          <targetClasses>
            <param>pricingengine.*</param>
          </targetClasses>
          <targetTests>
            <param>pricingengine.*</param>
          </targetTests>
        </configuration>
        <reportSets>
          <reportSet>
            <reports>
              <report>report</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>

レポートへの入力を取得pitestしてサイト レポートに出力するには、まず次の操作を行う必要があります。

mvn compile test-compile org.pitest:pitest-maven:mutationCoverage

これを実現するには、フェーズにバインドされた<build>プラグインとしてセクションでこれらのそれぞれを設定する必要がありますか? または、私が知らない別のプラグインを使用したより簡単なソリューションはありますか?executionspre-site

4

1 に答える 1

1

testただし、maven-surefire-report-plugin は、デフォルトのライフサイクルの目標を呼び出すことを明示的に述べています。残念なプラグインはそうではありません。そうです、pitest-maven プラグインをビルド セクションに追加し、それをライフサイクル フェーズにバインドする必要がありますpre-site。長時間実行される分析タスクを意図していないため、その目的でサイト ライフサイクルを使用することはお勧めしませんが、それはあなた次第です。

したがって、ビルド順序は次のとおりです。

  • ライフサイクルを構築する
    • モジュールをビルドします (コンパイル フェーズ)
    • テストを実行する (テスト フェーズ)
    • ミューテーション カバレッジを実行します (つまり、検証フェーズで)
  • サイトのライフサイクル
    • サイト前 (mutationCoverage);
    • レポートを生成する
    • レポートを公開する
    • ...

プロファイルを使用して、ミューテーション テストがすべてのビルドで実行されるのではなく、必要に応じてアクティブ化できるようにすることをお勧めします (つまりmvn site-P pit) 。

<profile>
  <id>pit</id>
  <build>
    <plugins>
        <plugin>
            <groupId>org.pitest</groupId>
            <artifactId>pitest-maven</artifactId>
            <configuration>
                <targetClasses>
                    <param>pricingengine.*</param>
                </targetClasses>
                <targetTests>
                    <param>pricingengine.*</param>
                </targetTests>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>mutationCoverage</goal>
                    </goals>
                    <phase>pre-site</phase>
                </execution>
            </executions>
        </plugin>
    </plugins>
  </build>
</profile>
于 2016-06-15T09:25:58.683 に答える