How to add a CodeBuild report for failsafe JUnit tests?

0

For my integration tests that are run by the failsafe Maven plugin, I added the section "IntegrationReports" in my buildspec file:

reports:
  SurefireReports: #surefire junit reports
    files:
      - '**/*'
    base-directory: 'target/surefire-reports'
  IntegrationReports: #failsafe junit reports
    files:
      - '**/*'
    base-directory: 'target/failsafe-reports'

The surefire reports are generated as expected but for the failsafe the build is failing with a message similar to this:

CLIENT_ERROR: Error in UPLOAD_ARTIFACTS phase: [IntegrationReports: [error processing report: [/codebuild/output/src415328417/target/failsafe-reports/failsafe-summary.xml: expected element type <testsuite> but have <failsafe-summary>]]]

The failsafe-summary.xml is generated by the Maven plugin maven-failsafe-plugin version 3.0.0-M8:

<?xml version="1.0" encoding="UTF-8"?>
<failsafe-summary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/failsafe-summary.xsd" result="null" timeout="false">
    <completed>9</completed>
    <errors>0</errors>
    <failures>0</failures>
    <skipped>0</skipped>
    <failureMessage xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</failsafe-summary>

Is there a way to show these reports?

質問済み 1年前206ビュー
1回答
0
承認された回答

The solution is actually simple: all I needed to do is eliminate the failsafe-summary.xml file from the list of reports. The relevant buildspec fragment becomes:

reports:
  SurefireReports: #surefire junit reports
    files:
      - '**/TEST*.xml'
    base-directory: 'target/surefire-reports'
  IntegrationReports: #failsafe junit reports
    files:
      - '**/TEST*.xml'
    base-directory: 'target/failsafe-reports'
回答済み 1年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ