Horizon
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
Catch::ReporterBase Class Reference

This is the base class for all reporters. More...

#include <catch_amalgamated.hpp>

Inheritance diagram for Catch::ReporterBase:
Catch::IEventListener Catch::StreamingReporterBase Catch::AutomakeReporter Catch::CompactReporter Catch::ConsoleReporter

Public Member Functions

 ReporterBase (ReporterConfig &&config)
 
void listReporters (std::vector< ReporterDescription > const &descriptions) override
 Provides a simple default listing of reporters.
 
void listListeners (std::vector< ListenerDescription > const &descriptions) override
 Provides a simple default listing of listeners.
 
void listTests (std::vector< TestCaseHandle > const &tests) override
 Provides a simple default listing of tests.
 
void listTags (std::vector< TagInfo > const &tags) override
 Provides a simple default listing of tags.
 
- Public Member Functions inherited from Catch::IEventListener
 IEventListener (IConfig const *config)
 
ReporterPreferences const & getPreferences () const
 
virtual void noMatchingTestCases (StringRef unmatchedSpec)=0
 Called when no test cases match provided test spec.
 
virtual void reportInvalidTestSpec (StringRef invalidArgument)=0
 Called for all invalid test specs from the cli.
 
virtual void testRunStarting (TestRunInfo const &testRunInfo)=0
 Called once in a testing run before tests are started.
 
virtual void testCaseStarting (TestCaseInfo const &testInfo)=0
 Called once for each TEST_CASE, no matter how many times it is entered.
 
virtual void testCasePartialStarting (TestCaseInfo const &testInfo, uint64_t partNumber)=0
 Called every time a TEST_CASE is entered, including repeats (due to sections)
 
virtual void sectionStarting (SectionInfo const &sectionInfo)=0
 Called when a SECTION is being entered. Not called for skipped sections.
 
virtual void benchmarkPreparing (StringRef benchmarkName)=0
 Called when user-code is being probed before the actual benchmark runs.
 
virtual void benchmarkStarting (BenchmarkInfo const &benchmarkInfo)=0
 Called after probe but before the user-code is being benchmarked.
 
virtual void benchmarkEnded (BenchmarkStats<> const &benchmarkStats)=0
 Called with the benchmark results if benchmark successfully finishes.
 
virtual void benchmarkFailed (StringRef benchmarkName)=0
 Called if running the benchmarks fails for any reason.
 
virtual void assertionStarting (AssertionInfo const &assertionInfo)=0
 Called before assertion success/failure is evaluated.
 
virtual void assertionEnded (AssertionStats const &assertionStats)=0
 Called after assertion was fully evaluated.
 
virtual void sectionEnded (SectionStats const &sectionStats)=0
 Called after a SECTION has finished running.
 
virtual void testCasePartialEnded (TestCaseStats const &testCaseStats, uint64_t partNumber)=0
 Called every time a TEST_CASE is entered, including repeats (due to sections)
 
virtual void testCaseEnded (TestCaseStats const &testCaseStats)=0
 Called once for each TEST_CASE, no matter how many times it is entered.
 
virtual void testRunEnded (TestRunStats const &testRunStats)=0
 Called once after all tests in a testing run are finished.
 
virtual void skipTest (TestCaseInfo const &testInfo)=0
 Called with test cases that are skipped due to the test run aborting.
 
virtual void fatalErrorEncountered (StringRef error)=0
 Called if a fatal error (signal/structured exception) occured.
 

Protected Attributes

Detail::unique_ptr< IStreamm_wrapped_stream
 The stream wrapper as passed to us by outside code.
 
std::ostream & m_stream
 Cached output stream from m_wrapped_stream to reduce number of indirect calls needed to write output.
 
Detail::unique_ptr< ColourImpl > m_colour
 Colour implementation this reporter was configured for.
 
std::map< std::string, std::string > m_customOptions
 The custom reporter options user passed down to the reporter.
 
- Protected Attributes inherited from Catch::IEventListener
ReporterPreferences m_preferences
 Derived classes can set up their preferences here.
 
IConfig const * m_config
 The test run's config as filled in from CLI and defaults.
 

Detailed Description

This is the base class for all reporters.

If are writing a reporter, you must derive from this type, or one of the helper reporter bases that are derived from this type.

ReporterBase centralizes handling of various common tasks in reporters, like storing the right stream for the reporters to write to, and providing the default implementation of the different listing events.

Member Function Documentation

◆ listListeners()

void Catch::ReporterBase::listListeners ( std::vector< ListenerDescription > const &  descriptions)
overridevirtual

Provides a simple default listing of listeners.

Looks similarly to listing of reporters, but with listener type instead of reporter name.

Implements Catch::IEventListener.

◆ listReporters()

void Catch::ReporterBase::listReporters ( std::vector< ReporterDescription > const &  descriptions)
overridevirtual

Provides a simple default listing of reporters.

Should look roughly like the reporter listing in v2 and earlier versions of Catch2.

Implements Catch::IEventListener.

◆ listTags()

void Catch::ReporterBase::listTags ( std::vector< TagInfo > const &  tags)
overridevirtual

Provides a simple default listing of tags.

Should look roughly like the tag listing in v2 and earlier versions of Catch2.

Implements Catch::IEventListener.

◆ listTests()

void Catch::ReporterBase::listTests ( std::vector< TestCaseHandle > const &  tests)
overridevirtual

Provides a simple default listing of tests.

Should look roughly like the test listing in v2 and earlier versions of Catch2. Especially supports low-verbosity listing that mimics the old --list-test-names-only output.

Implements Catch::IEventListener.


The documentation for this class was generated from the following files: