mimic++ v5
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 frameworks.
 

Classes

class  mimicpp::IReporter
 The reporter interface. More...
 
class  mimicpp::Error< Data >
 
class  mimicpp::BasicReporter< successReporter, warningReporter, failReporter >
 A reporter, which creates text messages and reports them via the provided callbacks. More...
 
class  mimicpp::DefaultReporter
 The default reporter. More...
 

Typedefs

using mimicpp::UnmatchedCallT = Error<std::tuple<CallReport, std::vector<MatchReport>>>
 
using mimicpp::UnfulfilledExpectationT = Error<ExpectationReport>
 

Functions

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

Detailed Description

Contains reporting related symbols.

Reporting is executed, when something notably has been detected by mimic++; often it is expected, that the reporter reacts to such a report in a specific manner (e.g. aborting the test case). For example the DefaultReporter simply throws exceptions on error reports, while other more specialized reporters handle such cases slightly different (but still abort the current test). These specialized Reporters are used to send reports to a specific destination (e.g. the utilized unit-test framework), which often provide more advanced mechanics for printing failed tests to the users.

Users may provide their own reporter implementation; e.g. if there is no reporter for the desired unit-test framework.

At any time there exists exactly one global reporter, which may be directly or indirectly exchanged by users. Reports are sent to the currently installed reporter via the report_xyz free-functions. Most of those functions require, that reports are handled in a specific manner (e.g. report_no_matches is expected to never return) and custom reporters must follow that specification, otherwise this will lead to undefined behavior. For further details, have a look at the specific function documentation.

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

Typedef Documentation

◆ UnfulfilledExpectationT

◆ UnmatchedCallT

using mimicpp::UnmatchedCallT = Error<std::tuple<CallReport, std::vector<MatchReport>>>

Function Documentation

◆ install_reporter()

template<std::derived_from< IReporter > T, typename... Args>
requires std::constructible_from<T, Args...>
void mimicpp::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.