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_XML_H_INCLUDED 8 #define TWOBLUECUBES_CATCH_REPORTER_XML_H_INCLUDED 9 10 #include "catch_reporter_bases.hpp" 11 12 #include "../internal/catch_xmlwriter.h" 13 #include "../internal/catch_timer.h" 14 15 16 namespace Catch { 17 class XmlReporter : public StreamingReporterBase<XmlReporter> { 18 public: 19 XmlReporter(ReporterConfig const& _config); 20 21 ~XmlReporter() override; 22 23 static std::string getDescription(); 24 25 virtual std::string getStylesheetRef() const; 26 27 void writeSourceInfo(SourceLineInfo const& sourceInfo); 28 29 public: // StreamingReporterBase 30 31 void noMatchingTestCases(std::string const& s) override; 32 33 void testRunStarting(TestRunInfo const& testInfo) override; 34 35 void testGroupStarting(GroupInfo const& groupInfo) override; 36 37 void testCaseStarting(TestCaseInfo const& testInfo) override; 38 39 void sectionStarting(SectionInfo const& sectionInfo) override; 40 41 void assertionStarting(AssertionInfo const&) override; 42 43 bool assertionEnded(AssertionStats const& assertionStats) override; 44 45 void sectionEnded(SectionStats const& sectionStats) override; 46 47 void testCaseEnded(TestCaseStats const& testCaseStats) override; 48 49 void testGroupEnded(TestGroupStats const& testGroupStats) override; 50 51 void testRunEnded(TestRunStats const& testRunStats) override; 52 53 #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) 54 void benchmarkPreparing(std::string const& name) override; 55 void benchmarkStarting(BenchmarkInfo const&) override; 56 void benchmarkEnded(BenchmarkStats<> const&) override; 57 void benchmarkFailed(std::string const&) override; 58 #endif // CATCH_CONFIG_ENABLE_BENCHMARKING 59 60 private: 61 Timer m_testCaseTimer; 62 XmlWriter m_xml; 63 int m_sectionDepth = 0; 64 }; 65 66 } // end namespace Catch 67 68 #endif // TWOBLUECUBES_CATCH_REPORTER_XML_H_INCLUDED 69