File indexing completed on 2025-01-18 09:54:07
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 ~JunitReporter() override = default;
0023
0024 static std::string getDescription();
0025
0026 void testRunStarting(TestRunInfo const& runInfo) override;
0027
0028 void testCaseStarting(TestCaseInfo const& testCaseInfo) override;
0029 void assertionEnded(AssertionStats const& assertionStats) override;
0030
0031 void testCaseEnded(TestCaseStats const& testCaseStats) override;
0032
0033 void testRunEndedCumulative() override;
0034
0035 private:
0036 void writeRun(TestRunNode const& testRunNode, double suiteTime);
0037
0038 void writeTestCase(TestCaseNode const& testCaseNode);
0039
0040 void writeSection( std::string const& className,
0041 std::string const& rootName,
0042 SectionNode const& sectionNode,
0043 bool testOkToFail );
0044
0045 void writeAssertions(SectionNode const& sectionNode);
0046 void writeAssertion(AssertionStats const& stats);
0047
0048 XmlWriter xml;
0049 Timer suiteTimer;
0050 std::string stdOutForSuite;
0051 std::string stdErrForSuite;
0052 unsigned int unexpectedExceptions = 0;
0053 bool m_okToFail = false;
0054 };
0055
0056 }
0057
0058 #endif