1 /* 2 * Created by Martin on 14/11/2017. 3 * 4 * Distributed under the Boost Software License, Version 1.0. (See accompanying 5 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 */ 7 #ifndef TWOBLUECUBES_CATCH_REPORTER_JUNIT_H_INCLUDED 8 #define TWOBLUECUBES_CATCH_REPORTER_JUNIT_H_INCLUDED 9 10 11 #include "catch_reporter_bases.hpp" 12 #include "../internal/catch_xmlwriter.h" 13 #include "../internal/catch_timer.h" 14 15 namespace Catch { 16 17 class JunitReporter : public CumulativeReporterBase<JunitReporter> { 18 public: 19 JunitReporter(ReporterConfig const& _config); 20 21 ~JunitReporter() override; 22 23 static std::string getDescription(); 24 25 void noMatchingTestCases(std::string const& /*spec*/) override; 26 27 void testRunStarting(TestRunInfo const& runInfo) override; 28 29 void testGroupStarting(GroupInfo const& groupInfo) override; 30 31 void testCaseStarting(TestCaseInfo const& testCaseInfo) override; 32 bool assertionEnded(AssertionStats const& assertionStats) override; 33 34 void testCaseEnded(TestCaseStats const& testCaseStats) override; 35 36 void testGroupEnded(TestGroupStats const& testGroupStats) override; 37 38 void testRunEndedCumulative() override; 39 40 void writeGroup(TestGroupNode const& groupNode, double suiteTime); 41 42 void writeTestCase(TestCaseNode const& testCaseNode); 43 44 void writeSection(std::string const& className, 45 std::string const& rootName, 46 SectionNode const& sectionNode); 47 48 void writeAssertions(SectionNode const& sectionNode); 49 void writeAssertion(AssertionStats const& stats); 50 51 XmlWriter xml; 52 Timer suiteTimer; 53 std::string stdOutForSuite; 54 std::string stdErrForSuite; 55 unsigned int unexpectedExceptions = 0; 56 bool m_okToFail = false; 57 }; 58 59 } // end namespace Catch 60 61 #endif // TWOBLUECUBES_CATCH_REPORTER_JUNIT_H_INCLUDED 62