Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 08:52:14

0001 
0002 //              Copyright Catch2 Authors
0003 // Distributed under the Boost Software License, Version 1.0.
0004 //   (See accompanying file LICENSE.txt or copy at
0005 //        https://www.boost.org/LICENSE_1_0.txt)
0006 
0007 // SPDX-License-Identifier: BSL-1.0
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 } // end namespace Catch
0055 
0056 #endif // CATCH_REPORTER_JUNIT_HPP_INCLUDED