mimic++ v9.2.1
Loading...
Searching...
No Matches
reporting

Contains reporting related symbols. More...

Collaboration diagram for reporting:

Topics

 reports
 Contains reports of mimic++ types.
 
 test framework adapters
 Reporter integrations for various third-party testing frameworks.
 

Classes

class  mimicpp::reporting::IReporter
 The reporter interface. More...
 

Functions

template<std::derived_from< IReporter > T, typename... Args>
requires std::constructible_from<T, Args...>
void mimicpp::reporting::install_reporter (Args &&... args)
 Replaces the previous reporter with a newly constructed one.
 

Detailed Description

Contains reporting related symbols.

Reporting in mimic++ is triggered when notable events are detected. The reporter is expected to respond to these reports in specific ways, often by aborting the test case. For instance, the DefaultReporter throws exceptions on error reports, while more specialized reporters may handle such cases differently, though still typically aborting the current test. These specialized reporters are designed to send reports to specific destinations (e.g., the unit-test framework in use), often providing more advanced mechanisms for displaying failed tests to users.

Users can implement their own reporters, which is particularly useful when there's no existing reporter for their preferred unit-test framework.

At any given time, there is exactly one active global reporter. Users can exchange this reporter either directly or indirectly (i.e. by including a certain adapter-header). Reports are sent to the currently installed reporter via the report_xyz free-functions. Most of these functions require reports to be handled in specific ways (e.g., report_no_matches is expected to never return). Custom reporters must adhere to these specifications to avoid undefined behavior. For more detailed information, please refer to the documentation of each specific function.

Note
In general users shall not directly interact with the installed reporter, except when they want to replace it.

Function Documentation

◆ install_reporter()

template<std::derived_from< IReporter > T, typename... Args>
requires std::constructible_from<T, Args...>
void mimicpp::reporting::install_reporter ( Args &&... args)

Replaces the previous reporter with a newly constructed one.

Template Parameters
TThe desired reporter type.
ArgsThe constructor argument types for T.
Parameters
argsThe constructor arguments.

This function accesses the globally available reporter and replaces it with a new instance.