MCPcopy Create free account
hub / github.com/apache/singa / PrintXmlUnitTest

Method PrintXmlUnitTest

test/gtest/gtest-all.cc:4843–4879  ·  view source on GitHub ↗

Prints an XML summary of unit_test to output stream out.

Source from the content-addressed store, hash-verified

4841
4842// Prints an XML summary of unit_test to output stream out.
4843void XmlUnitTestResultPrinter::PrintXmlUnitTest(std::ostream* stream,
4844 const UnitTest& unit_test) {
4845 const std::string kTestsuites = "testsuites";
4846
4847 *stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
4848 *stream << "<" << kTestsuites;
4849
4850 OutputXmlAttribute(stream, kTestsuites, "tests",
4851 StreamableToString(unit_test.reportable_test_count()));
4852 OutputXmlAttribute(stream, kTestsuites, "failures",
4853 StreamableToString(unit_test.failed_test_count()));
4854 OutputXmlAttribute(
4855 stream, kTestsuites, "disabled",
4856 StreamableToString(unit_test.reportable_disabled_test_count()));
4857 OutputXmlAttribute(stream, kTestsuites, "errors", "0");
4858 OutputXmlAttribute(
4859 stream, kTestsuites, "timestamp",
4860 FormatEpochTimeInMillisAsIso8601(unit_test.start_timestamp()));
4861 OutputXmlAttribute(stream, kTestsuites, "time",
4862 FormatTimeInMillisAsSeconds(unit_test.elapsed_time()));
4863
4864 if (GTEST_FLAG(shuffle)) {
4865 OutputXmlAttribute(stream, kTestsuites, "random_seed",
4866 StreamableToString(unit_test.random_seed()));
4867 }
4868
4869 *stream << TestPropertiesAsXmlAttributes(unit_test.ad_hoc_test_result());
4870
4871 OutputXmlAttribute(stream, kTestsuites, "name", "AllTests");
4872 *stream << ">\n";
4873
4874 for (int i = 0; i < unit_test.total_test_case_count(); ++i) {
4875 if (unit_test.GetTestCase(i)->reportable_test_count() > 0)
4876 PrintXmlTestCase(stream, *unit_test.GetTestCase(i));
4877 }
4878 *stream << "</" << kTestsuites << ">\n";
4879}
4880
4881// Produces a string representing the test properties in a result as space
4882// 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