我正在使用谷歌測驗框架在 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 確實將結果顯示為已跳過。是否有任何配置可以使跳過的計數出現。
謝謝你。
uj5u.com熱心網友回復:
應該是版本問題。我猜它是在這里添加的。標簽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
"><![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
確保您運行的是最新版本。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/474957.html
上一篇:如何使用XSLT洗掉wsse:Security標記?
下一篇:從XMLURL獲取圖示
