Horizon
Public Member Functions | Protected Attributes | List of all members
Catch::IEventListener Class Referenceabstract

The common base for all reporters and event listeners. More...

#include <catch_amalgamated.hpp>

Inheritance diagram for Catch::IEventListener:
Catch::EventListenerBase Catch::MultiReporter Catch::ReporterBase Catch::CumulativeReporterBase Catch::StreamingReporterBase Catch::JunitReporter Catch::SonarQubeReporter Catch::AutomakeReporter Catch::CompactReporter Catch::ConsoleReporter Catch::TAPReporter Catch::TeamCityReporter Catch::XmlReporter

Public Member Functions

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

Protected Attributes

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

The common base for all reporters and event listeners.

Implementing classes must also implement:

//! User-friendly description of the reporter/listener type
static std::string getDescription()

Generally shouldn't be derived from by users of Catch2 directly, instead they should derive from one of the utility bases that derive from this class.

Member Function Documentation

◆ assertionEnded()

virtual void Catch::IEventListener::assertionEnded ( AssertionStats const &  assertionStats)
pure virtual

◆ assertionStarting()

virtual void Catch::IEventListener::assertionStarting ( AssertionInfo const &  assertionInfo)
pure virtual

◆ benchmarkEnded()

virtual void Catch::IEventListener::benchmarkEnded ( BenchmarkStats<> const &  benchmarkStats)
pure virtual

Called with the benchmark results if benchmark successfully finishes.

Implemented in Catch::StreamingReporterBase, Catch::XmlReporter, Catch::CumulativeReporterBase, Catch::EventListenerBase, Catch::MultiReporter, and Catch::ConsoleReporter.

◆ benchmarkFailed()

virtual void Catch::IEventListener::benchmarkFailed ( StringRef  benchmarkName)
pure virtual

◆ benchmarkPreparing()

virtual void Catch::IEventListener::benchmarkPreparing ( StringRef  benchmarkName)
pure virtual

Called when user-code is being probed before the actual benchmark runs.

Implemented in Catch::ConsoleReporter, Catch::EventListenerBase, Catch::MultiReporter, Catch::XmlReporter, Catch::StreamingReporterBase, and Catch::CumulativeReporterBase.

◆ benchmarkStarting()

virtual void Catch::IEventListener::benchmarkStarting ( BenchmarkInfo const &  benchmarkInfo)
pure virtual

Called after probe but before the user-code is being benchmarked.

Implemented in Catch::StreamingReporterBase, Catch::CumulativeReporterBase, Catch::XmlReporter, Catch::EventListenerBase, Catch::MultiReporter, and Catch::ConsoleReporter.

◆ fatalErrorEncountered()

virtual void Catch::IEventListener::fatalErrorEncountered ( StringRef  error)
pure virtual

Called if a fatal error (signal/structured exception) occured.

Implemented in Catch::EventListenerBase, Catch::MultiReporter, Catch::StreamingReporterBase, and Catch::CumulativeReporterBase.

◆ listListeners()

virtual void Catch::IEventListener::listListeners ( std::vector< ListenerDescription > const &  descriptions)
pure virtual

Writes out the provided listeners descriptions using reporter-specific format.

Implemented in Catch::ReporterBase, Catch::EventListenerBase, Catch::MultiReporter, and Catch::XmlReporter.

◆ listReporters()

virtual void Catch::IEventListener::listReporters ( std::vector< ReporterDescription > const &  descriptions)
pure virtual

Writes out information about provided reporters using reporter-specific format.

Implemented in Catch::ReporterBase, Catch::EventListenerBase, Catch::MultiReporter, and Catch::XmlReporter.

◆ listTags()

virtual void Catch::IEventListener::listTags ( std::vector< TagInfo > const &  tags)
pure virtual

Writes out information about the provided tags using reporter-specific format.

Implemented in Catch::EventListenerBase, Catch::ReporterBase, Catch::MultiReporter, and Catch::XmlReporter.

◆ listTests()

virtual void Catch::IEventListener::listTests ( std::vector< TestCaseHandle > const &  tests)
pure virtual

Writes out information about provided tests using reporter-specific format.

Implemented in Catch::ReporterBase, Catch::EventListenerBase, Catch::MultiReporter, and Catch::XmlReporter.

◆ noMatchingTestCases()

virtual void Catch::IEventListener::noMatchingTestCases ( StringRef  unmatchedSpec)
pure virtual

◆ reportInvalidTestSpec()

virtual void Catch::IEventListener::reportInvalidTestSpec ( StringRef  invalidArgument)
pure virtual

◆ sectionEnded()

virtual void Catch::IEventListener::sectionEnded ( SectionStats const &  sectionStats)
pure virtual

◆ sectionStarting()

virtual void Catch::IEventListener::sectionStarting ( SectionInfo const &  sectionInfo)
pure virtual

◆ skipTest()

virtual void Catch::IEventListener::skipTest ( TestCaseInfo const &  testInfo)
pure virtual

Called with test cases that are skipped due to the test run aborting.

Implemented in Catch::StreamingReporterBase, Catch::CumulativeReporterBase, Catch::AutomakeReporter, Catch::EventListenerBase, and Catch::MultiReporter.

◆ testCaseEnded()

virtual void Catch::IEventListener::testCaseEnded ( TestCaseStats const &  testCaseStats)
pure virtual

◆ testCasePartialEnded()

virtual void Catch::IEventListener::testCasePartialEnded ( TestCaseStats const &  testCaseStats,
uint64_t  partNumber 
)
pure virtual

Called every time a TEST_CASE is entered, including repeats (due to sections)

Implemented in Catch::StreamingReporterBase, Catch::CumulativeReporterBase, Catch::EventListenerBase, and Catch::MultiReporter.

◆ testCasePartialStarting()

virtual void Catch::IEventListener::testCasePartialStarting ( TestCaseInfo const &  testInfo,
uint64_t  partNumber 
)
pure virtual

Called every time a TEST_CASE is entered, including repeats (due to sections)

Implemented in Catch::StreamingReporterBase, Catch::CumulativeReporterBase, Catch::EventListenerBase, and Catch::MultiReporter.

◆ testCaseStarting()

virtual void Catch::IEventListener::testCaseStarting ( TestCaseInfo const &  testInfo)
pure virtual

◆ testRunEnded()

virtual void Catch::IEventListener::testRunEnded ( TestRunStats const &  testRunStats)
pure virtual

Called once after all tests in a testing run are finished.

Not called if tests weren't run (e.g. only listings happened)

Implemented in Catch::StreamingReporterBase, Catch::CompactReporter, Catch::ConsoleReporter, Catch::TAPReporter, Catch::TeamCityReporter, Catch::CumulativeReporterBase, Catch::EventListenerBase, Catch::MultiReporter, and Catch::XmlReporter.

◆ testRunStarting()

virtual void Catch::IEventListener::testRunStarting ( TestRunInfo const &  testRunInfo)
pure virtual

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