我有一个 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 免费计划
最佳答案
在您提到的文档之后,有 Enabling the feature段落。
This feature comes with the :junit_pipeline_view feature flag disabled by default.
看起来公共(public) gitlab.com 上的功能已被禁用。如果您启动 GitLab 实例,则可以启用它。
更新:报告路径不正确:target/...
应为 gosecuri/target/...
关于java - Surefire 结果未显示在 gitlab CI/CD 的测试选项卡中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60770538/