File indexing completed on 2025-09-16 08:52:14
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef CATCH_REPORTER_JUNIT_HPP_INCLUDED
0009 #define CATCH_REPORTER_JUNIT_HPP_INCLUDED
0010
0011
0012 #include <catch2/reporters/catch_reporter_cumulative_base.hpp>
0013 #include <catch2/internal/catch_xmlwriter.hpp>
0014 #include <catch2/catch_timer.hpp>
0015
0016 namespace Catch {
0017
0018 class JunitReporter final : public CumulativeReporterBase {
0019 public:
0020 JunitReporter(ReporterConfig&& _config);
0021
0022 static std::string getDescription();
0023
0024 void testRunStarting(TestRunInfo const& runInfo) override;
0025
0026 void testCaseStarting(TestCaseInfo const& testCaseInfo) override;
0027 void assertionEnded(AssertionStats const& assertionStats) override;
0028
0029 void testCaseEnded(TestCaseStats const& testCaseStats) override;
0030
0031 void testRunEndedCumulative() override;
0032
0033 private:
0034 void writeRun(TestRunNode const& testRunNode, double suiteTime);
0035
0036 void writeTestCase(TestCaseNode const& testCaseNode);
0037
0038 void writeSection( std::string const& className,
0039 std::string const& rootName,
0040 SectionNode const& sectionNode,
0041 bool testOkToFail );
0042
0043 void writeAssertions(SectionNode const& sectionNode);
0044 void writeAssertion(AssertionStats const& stats);
0045
0046 XmlWriter xml;
0047 Timer suiteTimer;
0048 std::string stdOutForSuite;
0049 std::string stdErrForSuite;
0050 unsigned int unexpectedExceptions = 0;
0051 bool m_okToFail = false;
0052 };
0053
0054 }
0055
0056 #endif