| 599 | }; |
| 600 | |
| 601 | void 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 | |
| 645 | void TJUnitProcessor::MergeSubprocessReport() { |
| 646 | { |
nothing calls this directly
no test coverage detected