xml - gitlab ci:JUnit XML 解析失败:致命:文档末尾有额外内容
问题描述
我正在尝试在我的管道中创建单元测试报告,但我收到了这个错误。奇怪的是,有时当我对代码进行某些更改时,报告会成功解析,但在第二次运行时会发生此错误。我尝试了清除缓存之类的方法,但它不起作用。
ci.yaml 看起来像这样
build-job:
image: $IMAGE_REPO/$image:$version
script:
- ./build-and-test.sh
artifacts:
when: always
reports:
junit:
- $CI_PROJECT_DIR/build-dir/src/tests/reports/*.xml
build-and-test.sh 运行这个命令来运行测试:
ctest --output-on-failure -j 16 -R 'CI|Ci'
这会生成超过 100 个报告文件夹的 xml 报告,每个报告的名称类似于 <my_project> test .xml
每个文件都有以下内容:
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="1" failures="0" disabled="0" errors="0" time="0.069" timestamp="2021-06-08T22:51:07" name="AllTests">
<testsuite name="<test_name>" tests="1" failures="0" disabled="0" errors="0" time="0.069" timestamp="2021-06-08T22:51:07">
<testcase name="<test_case_name>" status="run" result="completed" time="0.069" timestamp="2021-06-08T22:51:07" classname="<test_name>" />
</testsuite>
</testsuites>
我使用 xml 检查器https://www.xmlvalidation.com/index.php?id=1&L=0检查这些 xml 文件的语法,它没有返回错误。我想知道我做错了什么?junit 解析器不是要一次解析多个文件吗?
解决方案
推荐阅读
- sql - 如何使用 substr 避免 DB2 Blu 中的 CTQ 运算符?
- kotlin - 具有不同返回类型的泛型函数
- macos - 默认值相当于从 MacOS 10.15 Catalina 中的 plist 中读取值
- kubernetes - 使用 CentOS7 为 Kubernetes Cluster On Premise 安装 nginx-ingress
- python-3.x - 您可以使用 Twilio python 向自己发送短信通知/消息吗?
- ubuntu-16.04 - 使用内核 4.8 为 Ubuntu 构建 bnx2 模块
- ms-access - SSIS OLEDB 源(使用 ODBC 连接)因连接失败错误而失败
- flutter - 消除小部件之间的间隙
- javascript - 为什么 people[1].a 无权访问 User 类的属性?
- python - AttributeError:“响应”对象没有属性“类型”