MCPcopy Create free account
hub / github.com/catboost/catboost / SerializeToXml

Method SerializeToXml

library/cpp/testing/unittest/junit.cpp:601–643  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

599};
600
601void TJUnitProcessor::SerializeToXml() {
602 TXmlWriter report(ResultReportFileName);
603 TXmlWriter::TTag testSuites = report.Tag("testsuites"sv);
604 testSuites
605 .Attribute("tests"sv, GetTestsCount())
606 .Attribute("failures"sv, GetFailuresCount());
607
608 for (const auto& [suiteName, suite] : Suites) {
609 auto testSuite = testSuites.Tag("testsuite"sv);
610 testSuite
611 .Attribute("name"sv, suiteName)
612 .Attribute("id"sv, suiteName)
613 .Attribute("tests"sv, suite.GetTestsCount())
614 .Attribute("failures"sv, suite.GetFailuresCount())
615 .Attribute("time"sv, suite.GetDurationSeconds());
616
617 for (const auto& [testName, test] : suite.Cases) {
618 auto testCase = testSuite.Tag("testcase"sv);
619 testCase
620 .Attribute("classname"sv, suiteName)
621 .Attribute("name"sv, testName)
622 .Attribute("id"sv, testName)
623 .Attribute("time"sv, test.DurationSecods);
624
625 for (const auto& failure : test.Failures) {
626 auto testFailure = testCase.Tag("failure"sv);
627 testFailure
628 .Attribute("message"sv, failure.Message)
629 .Attribute("type"sv, "ERROR"sv);
630 if (!failure.BackTrace.empty()) {
631 testFailure.Text(failure.BackTrace);
632 }
633 }
634
635 if (!test.StdOut.empty()) {
636 testCase.Tag("system-out"sv).Text(test.StdOut);
637 }
638 if (!test.StdErr.empty()) {
639 testCase.Tag("system-err"sv).Text(test.StdErr);
640 }
641 }
642 }
643}
644
645void TJUnitProcessor::MergeSubprocessReport() {
646 {

Callers

nothing calls this directly

Calls 7

AttributeMethod · 0.80
GetDurationSecondsMethod · 0.80
TagMethod · 0.45
GetTestsCountMethod · 0.45
GetFailuresCountMethod · 0.45
emptyMethod · 0.45
TextMethod · 0.45

Tested by

no test coverage detected