Prints an XML summary of unit_test to output stream out.
| 5330 | |
| 5331 | // Prints an XML summary of unit_test to output stream out. |
| 5332 | void XmlUnitTestResultPrinter::PrintXmlUnitTest(std::ostream* stream, |
| 5333 | const UnitTest& unit_test) { |
| 5334 | const std::string kTestsuites = "testsuites"; |
| 5335 | |
| 5336 | *stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; |
| 5337 | *stream << "<" << kTestsuites; |
| 5338 | |
| 5339 | OutputXmlAttribute(stream, kTestsuites, "tests", |
| 5340 | StreamableToString(unit_test.reportable_test_count())); |
| 5341 | OutputXmlAttribute(stream, kTestsuites, "failures", |
| 5342 | StreamableToString(unit_test.failed_test_count())); |
| 5343 | OutputXmlAttribute( |
| 5344 | stream, kTestsuites, "disabled", |
| 5345 | StreamableToString(unit_test.reportable_disabled_test_count())); |
| 5346 | OutputXmlAttribute(stream, kTestsuites, "errors", "0"); |
| 5347 | OutputXmlAttribute( |
| 5348 | stream, kTestsuites, "timestamp", |
| 5349 | FormatEpochTimeInMillisAsIso8601(unit_test.start_timestamp())); |
| 5350 | OutputXmlAttribute(stream, kTestsuites, "time", |
| 5351 | FormatTimeInMillisAsSeconds(unit_test.elapsed_time())); |
| 5352 | |
| 5353 | if (GTEST_FLAG(shuffle)) { |
| 5354 | OutputXmlAttribute(stream, kTestsuites, "random_seed", |
| 5355 | StreamableToString(unit_test.random_seed())); |
| 5356 | } |
| 5357 | *stream << TestPropertiesAsXmlAttributes(unit_test.ad_hoc_test_result()); |
| 5358 | |
| 5359 | OutputXmlAttribute(stream, kTestsuites, "name", "AllTests"); |
| 5360 | *stream << ">\n"; |
| 5361 | |
| 5362 | for (int i = 0; i < unit_test.total_test_suite_count(); ++i) { |
| 5363 | if (unit_test.GetTestSuite(i)->reportable_test_count() > 0) |
| 5364 | PrintXmlTestSuite(stream, *unit_test.GetTestSuite(i)); |
| 5365 | } |
| 5366 | *stream << "</" << kTestsuites << ">\n"; |
| 5367 | } |
| 5368 | |
| 5369 | void XmlUnitTestResultPrinter::PrintXmlTestsList( |
| 5370 | std::ostream* stream, const std::vector<TestSuite*>& test_suites) { |
nothing calls this directly
no test coverage detected