Home > Mobile >  Xml Generation from Google test does not show skipped test cases
Xml Generation from Google test does not show skipped test cases

Time:05-15

I am using google test framework for doing unit testing in c . I have few test cases which i have disabled using DISABLED_ before test name and some tests are skipped using GTEST_SKIP(). This is working fine and i can see the tests being disabled and skipped in the teminal log. The problem is when i am generating the xml file from the test.
I am using the following command.

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

The generated 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">

I would like to point out that the tag testsuites which is a consolidation of all the testsuite does not have an attribute skipped. The tag testsuite which is a consolidation of all the tests also does not have the attribute skipped. However, the test Test_1 does show the result as skipped. Is there any configuration to make the count of skipped appear.

Thank you.

CodePudding user response:

It's probably a version issue. I'm gussing it was added here. The tag testsuite has skipped for me:

<?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>

This is the example that I ran: https://godbolt.org/z/9aW7GrYfj

Make sure you are running the latest release.

  • Related