Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:07

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         ~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 } // end namespace Catch
0057 
0058 #endif // CATCH_REPORTER_JUNIT_HPP_INCLUDED