OTest2
A C++ testing framework
Public Member Functions | List of all members
OTest2::Reporter Class Referenceabstract

Generic test reporter. More...

#include <reporter.h>

Inheritance diagram for OTest2::Reporter:
Inheritance graph
[legend]

Public Member Functions

 Reporter (const Reporter &)=delete
 
Reporteroperator= (const Reporter &)=delete
 
 Reporter ()
 Ctor. More...
 
virtual ~Reporter ()
 Dtor. More...
 
virtual void enterTest (const Context &context_, const std::string &name_, const Parameters &params_)=0
 Enter entire test. More...
 
virtual void enterSuite (const Context &context_, const std::string &name_, const Parameters &params_)=0
 Enter a suite. More...
 
virtual void enterCase (const Context &context_, const std::string &name_, const Parameters &params_)=0
 Enter a case. More...
 
virtual void enterState (const Context &context_, const std::string &name_)=0
 Enter a state. More...
 
virtual AssertBufferPtr enterAssert (const Context &context_, bool condition_, const std::string &file_, int lineno_)=0
 Enter an assertion. More...
 
virtual AssertBufferPtr enterError (const Context &context_)=0
 Enter an error report. More...
 
virtual void leaveState (const Context &context_, const std::string &name_, bool result_)=0
 Leave a state. More...
 
virtual void leaveCase (const Context &context_, const std::string &name_, const Parameters &params_, bool result_)=0
 Leave a case. More...
 
virtual void leaveSuite (const Context &context_, const std::string &name_, const Parameters &params_, bool result_)=0
 Leave a suite. More...
 
virtual void leaveTest (const Context &context_, const std::string &name_, const Parameters &params_, bool result_)=0
 Leave entire test. More...
 

Detailed Description

Generic test reporter.

Definition at line 34 of file reporter.h.

Constructor & Destructor Documentation

◆ Reporter() [1/2]

OTest2::Reporter::Reporter ( const Reporter )
delete

◆ Reporter() [2/2]

OTest2::Reporter::Reporter ( )
default

Ctor.

◆ ~Reporter()

OTest2::Reporter::~Reporter ( )
virtualdefault

Dtor.

Member Function Documentation

◆ enterAssert()

virtual AssertBufferPtr OTest2::Reporter::enterAssert ( const Context context_,
bool  condition_,
const std::string &  file_,
int  lineno_ 
)
pure virtual

Enter an assertion.

The assertion is opened similarly to states, cases and suites until the AsssertBuffer::commitAssertion() method of the returned assertion buffer is invoked.

Warning
Just one assertion at time may be opened!
Parameters
context_the OTest2 context
condition_result of the assertion (false means failed assertion)
file_name of the source file
lineno_line number in the source file
Returns
An assertion buffer object which is used for formatting the assertion report.

Implemented in OTest2::ReporterConsole, OTest2::ReporterTee, and OTest2::ReporterJUnit.

◆ enterCase()

virtual void OTest2::Reporter::enterCase ( const Context context_,
const std::string &  name_,
const Parameters params_ 
)
pure virtual

Enter a case.

Parameters
context_the OTest2 context
name_Name of the case
params_Parameters of the testing object

Implemented in OTest2::ReporterConsole, OTest2::ReporterTee, and OTest2::ReporterJUnit.

◆ enterError()

virtual AssertBufferPtr OTest2::Reporter::enterError ( const Context context_)
pure virtual

Enter an error report.

This method is used to report errors happened in the testing framework. Errors mean failure of the test. However, they cannot be located in the user code (no filename, no line number). A good example is a not handled exception caught by the framework outside test cases.

The method works as well as the enterAssert() method with failed condition and with no location info. The opened error state is closed by the AssertBuffer::commitAssertion() method of the returned assertion buffer.

Warning
Just one assertion at time may be opened!
Parameters
context_the context
Returns
An assertion buffer object which is used for formatting the assertion report.

Implemented in OTest2::ReporterConsole, OTest2::ReporterTee, and OTest2::ReporterJUnit.

◆ enterState()

virtual void OTest2::Reporter::enterState ( const Context context_,
const std::string &  name_ 
)
pure virtual

Enter a state.

Parameters
context_the OTest2 context
name_Name of the state

Implemented in OTest2::ReporterConsole, OTest2::ReporterTee, and OTest2::ReporterJUnit.

◆ enterSuite()

virtual void OTest2::Reporter::enterSuite ( const Context context_,
const std::string &  name_,
const Parameters params_ 
)
pure virtual

Enter a suite.

Parameters
context_the OTest2 context
name_Name of the suite
params_Parameters of the testing object

Implemented in OTest2::ReporterConsole, OTest2::ReporterTee, and OTest2::ReporterJUnit.

◆ enterTest()

virtual void OTest2::Reporter::enterTest ( const Context context_,
const std::string &  name_,
const Parameters params_ 
)
pure virtual

Enter entire test.

Parameters
context_The OTest2 context
name_Name of the test
params_Parameters of the testing object

Implemented in OTest2::ReporterConsole, OTest2::ReporterTee, and OTest2::ReporterJUnit.

◆ leaveCase()

virtual void OTest2::Reporter::leaveCase ( const Context context_,
const std::string &  name_,
const Parameters params_,
bool  result_ 
)
pure virtual

Leave a case.

Parameters
context_the OTest2 context
name_Name of the case
params_Parameters of the testing object
result_Result of the case

Implemented in OTest2::ReporterConsole, OTest2::ReporterTee, and OTest2::ReporterJUnit.

◆ leaveState()

virtual void OTest2::Reporter::leaveState ( const Context context_,
const std::string &  name_,
bool  result_ 
)
pure virtual

Leave a state.

Parameters
context_the OTest2 context
name_Name of the state
result_Result of the state

Implemented in OTest2::ReporterConsole, OTest2::ReporterTee, and OTest2::ReporterJUnit.

◆ leaveSuite()

virtual void OTest2::Reporter::leaveSuite ( const Context context_,
const std::string &  name_,
const Parameters params_,
bool  result_ 
)
pure virtual

Leave a suite.

Parameters
context_the OTest2 context
name_Name of the suite
params_Parameters of the testing object
result_Result of the suite

Implemented in OTest2::ReporterConsole, OTest2::ReporterTee, and OTest2::ReporterJUnit.

◆ leaveTest()

virtual void OTest2::Reporter::leaveTest ( const Context context_,
const std::string &  name_,
const Parameters params_,
bool  result_ 
)
pure virtual

Leave entire test.

Parameters
context_the OTest2 context
name_Name of the leaving test
params_Parameters of the testing object
result_Result of the test

Implemented in OTest2::ReporterConsole, OTest2::ReporterTee, and OTest2::ReporterJUnit.

◆ operator=()

Reporter& OTest2::Reporter::operator= ( const Reporter )
delete

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