以下の内容はhttps://tech.unifa-e.com/entry/2022/09/27/173430より取得しました。


PHPUnit のカバレッジ結果を AWS CodeBuild で可視化する

こんにちは、rightgo09 です。

今回は、PHPUnit の実行とそのカバレッジの結果を AWS CodeBuild 上で行う方法をまとめます。

まとめ

結論としては PHPUnit のカバレッジ結果を Cobertura の XML として出力し、それを AWS CodeBuild の入力とすれば良いようです(現在 Clover 形式では AWS CodeBuild 内でエラーになってしまいました)。

AWS CodeBuild

buildspec.yml

カバレッジ付きの PHPUnit 実行部分

phases:
...
  build:
    commands:
...
      - ./vendor/bin/phpunit --coverage-cobertura coverage-report.xml

レポート出力部分

reports:
  coverage-report:
    files:
      - coverage-report.xml
    file-format: CoberturaXml

テストのコードカバレッジレポート


テスト結果のレポートも同時に出力する場合は、JUnit 形式の出力と入力をすれば可能です。

      - ./vendor/bin/phpunit --coverage-cobertura coverage-report.xml --log-junit unittest-report.xml
 reports:
   coverage-report:
     files:
       - coverage-report.xml
     file-format: CoberturaXml
+  unittest-report:
+    files:
+      - unittest-report.xml
+    file-format: JunitXml

テスト結果の可視化

以上です。

unifa-e.com




以上の内容はhttps://tech.unifa-e.com/entry/2022/09/27/173430より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14