【发布时间】:2022-02-23 17:06:31
【问题描述】:
我们有.NET Core 3 代码库,单元和集成测试在Gitlab CI 上运行。
问题是,当一个或多个单位/整数。测试失败,没有显示任何具体内容,您必须查看整个管道转储并搜索以查看单个失败的测试。
看https://docs.gitlab.com/ee/ci/unit_test_reports.html,Junit 报告正好解决了这个问题。
咨询How to capture structured xUnit test output in Gitlab CI?,还是没找到合适的解决方案。
主要问题是,有多个使用dotnet test 命令执行的测试项目:
gitlab.yaml 文件的当前快照:
artifacts:
when: always
reports:
junit: ./Test.xml
script:
- for proj in $(dotnet sln MySolution.sln list | grep 'Test.csproj$'); do dotnet test --logger "junit;LogFilePath=Test.xml" $proj; done
现在有问题的是脚本部分,我们在其中迭代所有测试程序集并对每个项目进行 dotnet 测试。
有没有办法以某种方式从每个项目中生成单个 junit xml 日志文件并将其提供给 junit 测试报告中的
reports:
junit: ./Test.xml
行?
【问题讨论】:
标签: junit gitlab continuous-integration gitlab-ci xunit