MCPcopy Create free account
hub / github.com/EmbeddedRPC/erpc / PrintXmlUnitTest

Method PrintXmlUnitTest

test/common/gtest/gtest.cpp:5151–5187  ·  view source on GitHub ↗

Prints an XML summary of unit_test to output stream out.

Source from the content-addressed store, hash-verified

5149
5150// Prints an XML summary of unit_test to output stream out.
5151void 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.

Callers

nothing calls this directly

Calls 11

StreamableToStringFunction · 0.85
reportable_test_countMethod · 0.80
failed_test_countMethod · 0.80
start_timestampMethod · 0.80
elapsed_timeMethod · 0.80
random_seedMethod · 0.80
total_test_case_countMethod · 0.80
GetTestCaseMethod · 0.80

Tested by

no test coverage detected