Xml 来自 Google 测试的生成不显示跳过的测试用例

Xml Generation from Google test does not show skipped test cases

我正在使用 google 测试框架在 C++ 中进行单元测试。我在测试名称之前使用 DISABLED_ 禁用了一些测试用例,并且使用 GTEST_SKIP() 跳过了一些测试。这工作正常,我可以在终端日志中看到测试被禁用和跳过。问题是当我从测试中生成 xml 文件时。
我正在使用以下命令。

--gtest_output=xml:/data/TestReport.xml

生成的XML

<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="17" failures="7" disabled="3" errors="0" time="57.713" timestamp="1970-01-04T10:31:55" name="AllTests">
<testsuite name="UNITTEST" tests="17" failures="7" disabled="3" errors="0" time="45.713" timestamp="1970-01-04T10:32:04">
<testcase name="Test_1" status="run" result="skipped" time="0" timestamp="1970-01-04T10:32:04" classname="UNITTEST" />
<testcase name="Test_2" status="run" result="completed" time="0.461" timestamp="1970-01-04T10:32:04" classname="UNITTEST" />
<testcase name="Test_3" status="run" result="completed" time="7.089" timestamp="1970-01-04T10:32:05" classname="UNITTEST">

我想指出的是,标签测试套件是所有测试套件的合并,没有跳过的属性。 作为所有测试的合并的标签 testsuite 也没有跳过属性。但是,测试 Test_1 确实将结果显示为已跳过。有什么配置可以让跳过的计数出现吗

谢谢。

可能是版本问题。我猜它是添加的 here。标签 testsuite 对我有 skipped:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="3" failures="0" disabled="0" errors="0" time="0" timestamp="2022-05-13T17:38:54.980" name="AllTests">
  <testsuite name="MyTestSuite" tests="3" failures="0" disabled="0" skipped="1" errors="0" time="0" timestamp="2022-05-13T17:38:54.980">
    <testcase name="Test1" status="run" result="skipped" time="0" timestamp="2022-05-13T17:38:54.980" classname="MyTestSuite">
      <skipped message="tests/gtest_demo/fib_test.cc:10&#x0A;"><![CDATA[tests/gtest_demo/fib_test.cc:10
]]></skipped>
    </testcase>
    <testcase name="Test2" status="run" result="completed" time="0" timestamp="2022-05-13T17:38:54.981" classname="MyTestSuite" />
    <testcase name="Test3" status="run" result="completed" time="0" timestamp="2022-05-13T17:38:54.981" classname="MyTestSuite" />
  </testsuite>
</testsuites>

这是我运行的例子:https://godbolt.org/z/9aW7GrYfj

确保你是运行最新版本。