| 2724 | } |
| 2725 | |
| 2726 | void test_run_end(const TestRunStats& p) override { |
| 2727 | // remove .exe extension - mainly to have the same output on UNIX and Windows |
| 2728 | std::string binary_name = skipPathFromFilename(opt.binary_name.c_str()); |
| 2729 | #ifdef DOCTEST_PLATFORM_WINDOWS |
| 2730 | if(binary_name.rfind(".exe") != std::string::npos) |
| 2731 | binary_name = binary_name.substr(0, binary_name.length() - 4); |
| 2732 | #endif // DOCTEST_PLATFORM_WINDOWS |
| 2733 | xml.startElement("testsuites"); |
| 2734 | xml.startElement("testsuite").writeAttribute("name", binary_name) |
| 2735 | .writeAttribute("errors", testCaseData.totalErrors) |
| 2736 | .writeAttribute("failures", testCaseData.totalFailures) |
| 2737 | .writeAttribute("tests", p.numAsserts); |
| 2738 | if(opt.no_time_in_output == false) { |
| 2739 | xml.writeAttribute("time", testCaseData.totalSeconds); |
| 2740 | xml.writeAttribute("timestamp", JUnitTestCaseData::getCurrentTimestamp()); |
| 2741 | } |
| 2742 | if(opt.no_version == false) |
| 2743 | xml.writeAttribute("doctest_version", DOCTEST_VERSION_STR); |
| 2744 | |
| 2745 | for(const auto& testCase : testCaseData.testcases) { |
| 2746 | xml.startElement("testcase") |
| 2747 | .writeAttribute("classname", testCase.classname) |
| 2748 | .writeAttribute("name", testCase.name); |
| 2749 | if(opt.no_time_in_output == false) |
| 2750 | xml.writeAttribute("time", testCase.time); |
| 2751 | // This is not ideal, but it should be enough to mimic gtest's junit output. |
| 2752 | xml.writeAttribute("status", "run"); |
| 2753 | |
| 2754 | for(const auto& failure : testCase.failures) { |
| 2755 | xml.scopedElement("failure") |
| 2756 | .writeAttribute("message", failure.message) |
| 2757 | .writeAttribute("type", failure.type) |
| 2758 | .writeText(failure.details, false); |
| 2759 | } |
| 2760 | |
| 2761 | for(const auto& error : testCase.errors) { |
| 2762 | xml.scopedElement("error") |
| 2763 | .writeAttribute("message", error.message) |
| 2764 | .writeText(error.details); |
| 2765 | } |
| 2766 | |
| 2767 | xml.endElement(); |
| 2768 | } |
| 2769 | xml.endElement(); |
| 2770 | xml.endElement(); |
| 2771 | } |
| 2772 | |
| 2773 | void test_case_start(const TestCaseData& in) override { |
| 2774 | testCaseData.add(skipPathFromFilename(in.m_file.c_str()), in.m_name); |
nothing calls this directly
no test coverage detected