catch_reporter_junit.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. #include "catch_reporter_bases.hpp"
  10. #include "../internal/catch_xmlwriter.h"
  11. #include "../internal/catch_timer.h"
  12. namespace Catch {
  13. class JunitReporter : public CumulativeReporterBase<JunitReporter> {
  14. public:
  15. JunitReporter(ReporterConfig const& _config);
  16. ~JunitReporter() override;
  17. static std::string getDescription();
  18. void noMatchingTestCases(std::string const& /*spec*/) override;
  19. void testRunStarting(TestRunInfo const& runInfo) override;
  20. void testGroupStarting(GroupInfo const& groupInfo) override;
  21. void testCaseStarting(TestCaseInfo const& testCaseInfo) override;
  22. bool assertionEnded(AssertionStats const& assertionStats) override;
  23. void testCaseEnded(TestCaseStats const& testCaseStats) override;
  24. void testGroupEnded(TestGroupStats const& testGroupStats) override;
  25. void testRunEndedCumulative() override;
  26. void writeGroup(TestGroupNode const& groupNode, double suiteTime);
  27. void writeTestCase(TestCaseNode const& testCaseNode);
  28. void writeSection(std::string const& className,
  29. std::string const& rootName,
  30. SectionNode const& sectionNode);
  31. void writeAssertions(SectionNode const& sectionNode);
  32. void writeAssertion(AssertionStats const& stats);
  33. XmlWriter xml;
  34. Timer suiteTimer;
  35. std::string stdOutForSuite;
  36. std::string stdErrForSuite;
  37. unsigned int unexpectedExceptions = 0;
  38. bool m_okToFail = false;
  39. };
  40. } // end namespace Catch
  41. #endif // TWOBLUECUBES_CATCH_REPORTER_JUNIT_H_INCLUDED