Prints an XML summary of unit_test to output stream out.
| 5149 | |
| 5150 | // Prints an XML summary of unit_test to output stream out. |
| 5151 | void XmlUnitTestResultPrinter::PrintXmlUnitTest(std::ostream* stream, |
| 5152 | const UnitTest& unit_test) { |
| 5153 | const std::string kTestsuites = "testsuites"; |
| 5154 | |
| 5155 | *stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; |
| 5156 | *stream << "<" << kTestsuites; |
| 5157 | |
| 5158 | OutputXmlAttribute(stream, kTestsuites, "tests", |
| 5159 | StreamableToString(unit_test.reportable_test_count())); |
| 5160 | OutputXmlAttribute(stream, kTestsuites, "failures", |
| 5161 | StreamableToString(unit_test.failed_test_count())); |
| 5162 | OutputXmlAttribute( |
| 5163 | stream, kTestsuites, "disabled", |
| 5164 | StreamableToString(unit_test.reportable_disabled_test_count())); |
| 5165 | OutputXmlAttribute(stream, kTestsuites, "errors", "0"); |
| 5166 | OutputXmlAttribute( |
| 5167 | stream, kTestsuites, "timestamp", |
| 5168 | FormatEpochTimeInMillisAsIso8601(unit_test.start_timestamp())); |
| 5169 | OutputXmlAttribute(stream, kTestsuites, "time", |
| 5170 | FormatTimeInMillisAsSeconds(unit_test.elapsed_time())); |
| 5171 | |
| 5172 | if (GTEST_FLAG(shuffle)) { |
| 5173 | OutputXmlAttribute(stream, kTestsuites, "random_seed", |
| 5174 | StreamableToString(unit_test.random_seed())); |
| 5175 | } |
| 5176 | |
| 5177 | *stream << TestPropertiesAsXmlAttributes(unit_test.ad_hoc_test_result()); |
| 5178 | |
| 5179 | OutputXmlAttribute(stream, kTestsuites, "name", "AllTests"); |
| 5180 | *stream << ">\n"; |
| 5181 | |
| 5182 | for (int i = 0; i < unit_test.total_test_case_count(); ++i) { |
| 5183 | if (unit_test.GetTestCase(i)->reportable_test_count() > 0) |
| 5184 | PrintXmlTestCase(stream, *unit_test.GetTestCase(i)); |
| 5185 | } |
| 5186 | *stream << "</" << kTestsuites << ">\n"; |
| 5187 | } |
| 5188 | |
| 5189 | // Produces a string representing the test properties in a result as space |
| 5190 | // delimited XML attributes based on the property key="value" pairs. |
nothing calls this directly
no test coverage detected