googletest 测试报告格式是标准吗?

问题描述

以下是调用我的 googletest 生成的 xml 格式输出

$ GTEST_OUTPUT=xml:/path/to/ ctest --verbose
$ cat /path/to/IntUtilsTest.xml
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="1" failures="0" disabled="0" errors="0" timestamp="2021-07-07T23:25:35" time="0.008" name="AllTests">
  <testsuite name="gitflow_tester" tests="1" failures="0" disabled="0" errors="0" time="0.002">
    <testcase name="zero_plus_five_equals_5" status="run" time="0.001" classname="gitflow_tester" />
  </testsuite>
</testsuites>

googletest xml格式的测试结果输出标准吗?
IE。以上是否符合所有生成 xml 格式测试结果的测试包之后的模式?
换句话说,如果解析/以编程方式对上述 xml 做出反应,如果测试套件从 googletest 更改为 cxxtest 或 cpptest 等,是否不需要更改?


我尝试过的:

在此处使用 JUnit xsd 验证上述 xml 示例:https://github.com/windyroad/JUnit-Schema/blob/master/JUnit.xsd 使用以下两个 xml/xsd 验证器:

Cvc-complex-type.3.2.2: Attribute 'tests' Is Not Allowed To Appear In Element 'testsuites'.,Line '1',Column '121'.
Cvc-complex-type.3.2.2: Attribute 'failures' Is Not Allowed To Appear In Element 'testsuites'.,Column '121'.
Cvc-complex-type.3.2.2: Attribute 'disabled' Is Not Allowed To Appear In Element 'testsuites'.,Column '121'.
Cvc-complex-type.3.2.2: Attribute 'errors' Is Not Allowed To Appear In Element 'testsuites'.,Column '121'.
Cvc-complex-type.3.2.2: Attribute 'timestamp' Is Not Allowed To Appear In Element 'testsuites'.,Column '121'.
Cvc-complex-type.3.2.2: Attribute 'time' Is Not Allowed To Appear In Element 'testsuites'.,Column '121'.
Cvc-complex-type.3.2.2: Attribute 'name' Is Not Allowed To Appear In Element 'testsuites'.,Column '121'.
Cvc-complex-type.3.2.2: Attribute 'disabled' Is Not Allowed To Appear In Element 'testsuite'.,Line '2',Column '96'.
Cvc-complex-type.4: Attribute 'package' Must Appear On Element 'testsuite'.,Column '96'.
Cvc-complex-type.4: Attribute 'id' Must Appear On Element 'testsuite'.,Column '96'.
Cvc-complex-type.4: Attribute 'timestamp' Must Appear On Element 'testsuite'.,Column '96'.
Cvc-complex-type.4: Attribute 'hostname' Must Appear On Element 'testsuite'.,Column '96'.
Cvc-complex-type.2.4.a: Invalid Content Was Found Starting With Element 'testcase'. One Of '{properties}' Is Expected.,Line '3',Column '101'.
Cvc-complex-type.3.2.2: Attribute 'status' Is Not Allowed To Appear In Element 'testcase'.,Column '101'.

解决方法

它是 JUnit。对于 XMLSchema,请参阅:https://github.com/windyroad/JUnit-Schema/blob/master/JUnit.xsd

,

我在这里找到了一个更好的 JUnit XML 模式:

https://github.com/junit-team/junit5/releases/tag/r5.7.2

下载 ZIP 并查找 jenkins-junit.xsd

或直接使用:

https://raw.githubusercontent.com/junit-team/junit5/main/platform-tests/src/test/resources/jenkins-junit.xsd

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...