google / googletest

GoogleTest - Google Testing and Mocking Framework
https://google.github.io/googletest/
BSD 3-Clause "New" or "Revised" License
34.72k stars 10.14k forks source link

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

Open satishsingh0077 opened 2 years ago

satishsingh0077 commented 2 years ago

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

` 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.
ourarash commented 2 years ago

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);
}
satishsingh0077 commented 2 years ago

Is there any update on this issue?