google / googletest

GoogleTest - Google Testing and Mocking Framework

Home Page:https://google.github.io/googletest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Xml Generation from Google test does not show skipped test cases count in tag testsuites

satishsingh0077 opened this issue · comments

I am using gtest version V1.11.0

I have disabled few tests and Skipped few tests. 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.
--gtest_output=xml:/data/TestReport.xml
The generated XML
<?xml version="1.0" encoding="UTF-8"?> <testsuites tests="3" failures="0" disabled="1" errors="0" time="0" timestamp="2022-05-14T18:48:32.196" name="AllTests"> <testsuite name="Suite1" tests="2" failures="0" disabled="1" skipped="0" errors="0" time="0" timestamp="2022-05-14T18:48:32.196"> <testcase name="Test1" file="/home/satish/Documents/gtestNew/sqrt_test.cpp" line="6" status="run" result="completed" time="0" timestamp="2022-05-14T18:48:32.196" classname="Suite1" /> <testcase name="DISABLED_Test2" file="/home/satish/Documents/gtestNew/sqrt_test.cpp" line="11" status="notrun" result="suppressed" time="0" timestamp="1970-01-01T01:00:00.000" classname="Suite1" /> </testsuite> <testsuite name="Suite2" tests="1" failures="0" disabled="0" skipped="1" errors="0" time="0" timestamp="2022-05-14T18:48:32.197"> <testcase name="Test3" file="/home/satish/Documents/gtestNew/sqrt_test.cpp" line="16" status="run" result="skipped" time="0" timestamp="2022-05-14T18:48:32.197" classname="Suite2"> <skipped message="/home/satish/Documents/gtestNew/sqrt_test.cpp:18&#x0A;"><![CDATA[/home/satish/Documents/gtestNew/sqrt_test.cpp:18]]></skipped> </testcase> </testsuite> </testsuites>

I would like to point out that the tag testsuites which is a consolidation of all the testsuite does not have an attribute skipped.
However, the attribute is present in tag testsuite which does show the count of disabled and skipped.

Here is another example:

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

Notice that testsuite tag has skipped but testsuites does not.

This is the example that I ran:

TEST(MyTestSuite, Test1) {
  ::testing::GTEST_FLAG(output) = "xml:out.xml";
  GTEST_SKIP();

  EXPECT_TRUE(1 == 1);
}
TEST(MyTestSuite, Test2) {
  EXPECT_TRUE(1 == 1);
}


TEST(MyTestSuite, Test3) {
  EXPECT_TRUE(1 == 1);
}

Is there any update on this issue?