catch_reporter_xml.h 2.1 KB

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