File indexing completed on 2025-01-18 09:54:08
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef CATCH_REPORTER_XML_HPP_INCLUDED
0009 #define CATCH_REPORTER_XML_HPP_INCLUDED
0010
0011 #include <catch2/reporters/catch_reporter_streaming_base.hpp>
0012
0013 #include <catch2/internal/catch_xmlwriter.hpp>
0014 #include <catch2/catch_timer.hpp>
0015
0016
0017 namespace Catch {
0018 class XmlReporter : public StreamingReporterBase {
0019 public:
0020 XmlReporter(ReporterConfig&& _config);
0021
0022 ~XmlReporter() override;
0023
0024 static std::string getDescription();
0025
0026 virtual std::string getStylesheetRef() const;
0027
0028 void writeSourceInfo(SourceLineInfo const& sourceInfo);
0029
0030 public:
0031
0032 void testRunStarting(TestRunInfo const& testInfo) override;
0033
0034 void testCaseStarting(TestCaseInfo const& testInfo) override;
0035
0036 void sectionStarting(SectionInfo const& sectionInfo) override;
0037
0038 void assertionStarting(AssertionInfo const&) override;
0039
0040 void assertionEnded(AssertionStats const& assertionStats) override;
0041
0042 void sectionEnded(SectionStats const& sectionStats) override;
0043
0044 void testCaseEnded(TestCaseStats const& testCaseStats) override;
0045
0046 void testRunEnded(TestRunStats const& testRunStats) override;
0047
0048 void benchmarkPreparing( StringRef name ) override;
0049 void benchmarkStarting(BenchmarkInfo const&) override;
0050 void benchmarkEnded(BenchmarkStats<> const&) override;
0051 void benchmarkFailed( StringRef error ) override;
0052
0053 void listReporters(std::vector<ReporterDescription> const& descriptions) override;
0054 void listListeners(std::vector<ListenerDescription> const& descriptions) override;
0055 void listTests(std::vector<TestCaseHandle> const& tests) override;
0056 void listTags(std::vector<TagInfo> const& tags) override;
0057
0058 private:
0059 Timer m_testCaseTimer;
0060 XmlWriter m_xml;
0061 int m_sectionDepth = 0;
0062 };
0063
0064 }
0065
0066 #endif