Class CumulativeReporterBase

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Derived Types

Class Documentation

class CumulativeReporterBase : public Catch::ReporterBase

Utility base for reporters that need to handle all results at once

It stores tree of all test cases, sections and assertions, and after the test run is finished, calls into testRunEndedCumulative to pass the control to the deriving class.

If you are deriving from this class and override any testing related member functions, you should first call into the base’s implementation to avoid breaking the tree construction.

Due to the way this base functions, it has to expand assertions up-front, even if they are later unused (e.g. because the deriving reporter does not report successful assertions, or because the deriving reporter does not use assertion expansion at all). Derived classes can use two customization points, m_shouldStoreSuccesfulAssertions and m_shouldStoreFailedAssertions, to disable the expansion and gain extra performance. Accessing the assertion expansions if it wasn’t stored is UB.

Subclassed by Catch::JunitReporter, Catch::SonarQubeReporter

Public Types

using TestCaseNode = Node<TestCaseStats, SectionNode>
using TestRunNode = Node<TestRunStats, TestCaseNode>

Public Functions

inline CumulativeReporterBase(ReporterConfig &&_config)
~CumulativeReporterBase() override
inline void benchmarkPreparing(StringRef) override
inline void benchmarkStarting(BenchmarkInfo const&) override
void benchmarkEnded(BenchmarkStats<> const &benchmarkStats) override
inline void benchmarkFailed(StringRef) override
inline void noMatchingTestCases(StringRef) override
inline void reportInvalidTestSpec(StringRef) override
inline void fatalErrorEncountered(StringRef) override
inline void testRunStarting(TestRunInfo const&) override
inline void testCaseStarting(TestCaseInfo const&) override
inline void testCasePartialStarting(TestCaseInfo const&, uint64_t) override
void sectionStarting(SectionInfo const &sectionInfo) override
inline void assertionStarting(AssertionInfo const&) override
void assertionEnded(AssertionStats const &assertionStats) override
void sectionEnded(SectionStats const &sectionStats) override
inline void testCasePartialEnded(TestCaseStats const&, uint64_t) override
void testCaseEnded(TestCaseStats const &testCaseStats) override
void testRunEnded(TestRunStats const &testRunStats) override
virtual void testRunEndedCumulative() = 0

Customization point: called after last test finishes (testRunEnded has been handled)

inline void skipTest(TestCaseInfo const&) override

Protected Attributes

bool m_shouldStoreSuccesfulAssertions = true

Should the cumulative base store the assertion expansion for successful assertions?

bool m_shouldStoreFailedAssertions = true

Should the cumulative base store the assertion expansion for failed assertions?

Detail::unique_ptr<TestRunNode> m_testRun

The root node of the test run tree.

template<typename T, typename ChildNodeT>
struct Node

Public Types

using ChildNodes = std::vector<Detail::unique_ptr<ChildNodeT>>

Public Functions

inline explicit Node(T const &_value)

Public Members

T value
ChildNodes children
struct SectionNode

Public Functions

inline explicit SectionNode(SectionStats const &_stats)
inline bool operator==(SectionNode const &other) const
bool hasAnyAssertions() const

Public Members

SectionStats stats
std::vector<Detail::unique_ptr<SectionNode>> childSections
std::vector<Detail::AssertionOrBenchmarkResult> assertionsAndBenchmarks
std::string stdOut
std::string stdErr