surefire结果未显示在gitlab CI / CD的测试选项卡中

时间:2020-03-20 08:08:52

标签: java junit continuous-integration gitlab maven-surefire-plugin

我有一个Java Maven应用程序,我试图在gitlab上显示我的junit结果,如gitlab帮助中所示:https://docs.gitlab.com/ee/ci/junit_test_reports.html#viewing-junit-test-reports-on-gitlab

我在pom版本中添加了maven-surefire-plugin,在pom报告部分中添加了maven-surefire-report-plugin。我检查了它是否有效,因为surefire-report.html是在我的本地目标存储库中正确创建的,并带有测试结果。

然后我通过添加最后几行来配置gitlabci.yaml:

image: "maven"
before_script:
  - cd gosecuri
stages:
  - build
  - test
  - run
job_build:
  stage: build
  script:
    - mvn compile
job_test:
  stage: test
  script:
    - mvn package
  artifacts:
    paths:
    - gosecuri/target/*.war
    expire_in: 1 week
    reports:
      junit:
        - target/surefire-reports/TEST-*.xml

管道成功。在gitlab中,我收到消息“没有要显示的测试”。在作业测试标签和控制台中,我收到以下警告: target / surefire-reports / TEST-*。xml:没有匹配的文件

我想念什么?谢谢

PS:我正在gitlab.com中运行Saas免费计划

1 个答案:

答案 0 :(得分:1)

您提到的文档后面紧跟着Enabling the feature段落。

此功能随附:junit_pipeline_view功能标志已禁用 默认情况下。

在公共gitlab.com上禁用了类似功能。如果启动GitLab实例,则可以启用它。

更新:报告路径不正确:target/...应该为gosecuri/target/...