MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / PrintXmlUnitTest

Method PrintXmlUnitTest

tests/gtest/gtest-all.cc:5332–5367  ·  view source on GitHub ↗

Prints an XML summary of unit_test to output stream out.

Source from the content-addressed store, hash-verified

5330
5331// Prints an XML summary of unit_test to output stream out.
5332void 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
5369void XmlUnitTestResultPrinter::PrintXmlTestsList(
5370 std::ostream* stream, const std::vector<TestSuite*>& test_suites) {

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
GetTestSuiteMethod · 0.80

Tested by

no test coverage detected