tij*_*ter 5 junit continuous-integration gitlab cypress
我正在尝试在 Gitlab CI 上上传 J-unit 报告(这些是我的 Cypress 自动化框架的测试结果)。我正在使用 Junit 合并。由于 Cypress 的架构(每个测试都是孤立的),它需要额外的“合并”报告才能将它们放入一个文件中。本地一切正常:
尝试在本地调试它,但在本地一切正常。我能想到的可能性:合并脚本处理不正确或者Gitlab不接受.xml文件的相对路径。
{
"baseUrl": "https://www-acc.anwb.nl/",
"reporter": "mocha-junit-reporter",
"reporterOptions": {
"mochaFile": "results/resultsreport.[hash].xml",
"testsuiteTitle": "true"
}
}
Run Code Online (Sandbox Code Playgroud)
赛普拉斯-E2E:
image: cypress/base:10
stage: test
script:
- npm run cy:run:staging
- npx junit-merge -d results -o results/results.xml
artifacts:
paths:
- results/results.xml
reports:
junit: results/results.xml
expire_in: 1 week
Run Code Online (Sandbox Code Playgroud)
同样,本地一切都按预期进行。我从 gitlab Ci 得到的错误是:
Uploading artifacts...
WARNING: results/results.xml: no matching files
ERROR: No files to upload
ERROR: Job failed: exit code 1
Run Code Online (Sandbox Code Playgroud)
Artifacts can only exist in
directories relative to the build directory and specifying paths which don't
comply to this rule trigger an unintuitive and illogical error message (an
enhancement is discussed at
gitlab-ce#15530
). Artifacts need to be uploaded to the GitLab instance (not only the GitLab
runner) before the next stage job(s) can start, so you need to evaluate
carefully whether your bandwidth allows you to profit from parallelization
with stages and shared artifacts before investing time in changes to the
setup.
Run Code Online (Sandbox Code Playgroud)
https://gitlab.com/gitlab-org/gitlab-ee/tree/master/doc/ci/caching
这意味着下一个配置应该可以解决问题:
artifacts:
reports:
junit: <testing-repo>/results/results.xml
expire_in: 1 week
Run Code Online (Sandbox Code Playgroud)