xtd.tunit - Reference Guide  1.0.0
Modern c++17 unit testing framework on Windows, macOS, Linux, iOS and android.
xtd::tunit::ostream_event_listener Class Reference

The ostream_unit_test class is a specialisation of event_listener class for writing events in std::ostream. More...

#include <ostream_event_listener.h>

Inheritance diagram for xtd::tunit::ostream_event_listener:
xtd::tunit::event_listener

Public Member Functions

 ostream_event_listener (std::ostream &os) noexcept
 Creates new instance ostream event lister with ostream specified. More...
 
virtual void on_class_cleanup_end (const xtd::tunit::class_event_args &e) const
 Occurs when class cleanup is ended. More...
 
virtual void on_class_cleanup_start (const xtd::tunit::class_event_args &e) const
 Occurs when class cleanup is started. More...
 
virtual void on_class_end (const xtd::tunit::class_event_args &e) const
 Occurs when class is ended. More...
 
virtual void on_class_initialize_end (const xtd::tunit::class_event_args &e) const
 Occurs when class initialize is ended. More...
 
virtual void on_class_initialize_start (const xtd::tunit::class_event_args &e) const
 Occurs when class initialize is started. More...
 
virtual void on_class_start (const xtd::tunit::class_event_args &e) const
 Occurs when class is started. More...
 
void on_test_aborted (const xtd::tunit::test_event_args &e) const override
 Occurs when test is aborted. More...
 
virtual void on_test_cleanup_end (const xtd::tunit::test_event_args &e) const
 Occurs when test cleanup is ended. More...
 
virtual void on_test_cleanup_start (const xtd::tunit::test_event_args &e) const
 Occurs when test cleanup is started. More...
 
virtual void on_test_end (const xtd::tunit::test_event_args &e) const
 Occurs when test is ended. More...
 
void on_test_failed (const xtd::tunit::test_event_args &e) const override
 Occurs when test is failed. More...
 
void on_test_ignored (const xtd::tunit::test_event_args &e) const override
 Occurs when test is ignored. More...
 
virtual void on_test_initialize_end (const xtd::tunit::test_event_args &e) const
 Occurs when test initialize is ended. More...
 
virtual void on_test_initialize_start (const xtd::tunit::test_event_args &e) const
 Occurs when test initialize is ended. More...
 
virtual void on_test_start (const xtd::tunit::test_event_args &e) const
 Occurs when test initialize is started. More...
 
void on_test_succeed (const xtd::tunit::test_event_args &e) const override
 Occurs when test is succeed. More...
 
virtual void on_unit_test_cleanup_end (const xtd::tunit::tunit_event_args &e) const
 Occurs when unit test cleanup is ended. More...
 
virtual void on_unit_test_cleanup_start (const xtd::tunit::tunit_event_args &e) const
 Occurs when unit test is started. More...
 
void on_unit_test_end (const xtd::tunit::tunit_event_args &e) const override
 Occurs when unit test is ended. More...
 
virtual void on_unit_test_initialize_end (const xtd::tunit::tunit_event_args &e) const
 Occurs when unit test initalize is ended. More...
 
virtual void on_unit_test_initialize_start (const xtd::tunit::tunit_event_args &e) const
 Occurs when unit test initialize is ended. More...
 
void on_unit_test_start (const xtd::tunit::tunit_event_args &e) const override
 Occurs when unit test cleanup is started. More...
 

Detailed Description

The ostream_unit_test class is a specialisation of event_listener class for writing events in std::ostream.

Remarks
This class is use by console_unit_test.
you can use this class as you want as for example communicate between network.
Examples
The following examples show how to use ostream_event_listener.
#include <xtd/xtd.tunit>
#include <sstream>
using namespace std;
using namespace xtd::tunit;
namespace unit_tests {
class test_class_(test) {
public:
void test_method_(test_case1) {
}
};
}
// The main entry point for the application.
int main() {
// create your own ostream in this case a string stream for example
stringstream ss;
// create and run an ostream_unit_test
int result = ostream_unit_test(ss).run();
// display string stream on cout line by line
string line;
while(std::getline(ss, line))
cout << line << endl;
return result;
}
// This code can produce the following output:
//
// Start 1 test from 1 test case
// Run tests:
// SUCCEED test.test_case1 (0 ms total)
//
// Test results:
// SUCCEED 1 test.
// End 1 test from 1 test case ran. (0 ms total)

Constructor & Destructor Documentation

§ ostream_event_listener()

xtd::tunit::ostream_event_listener::ostream_event_listener ( std::ostream &  os)
inlinenoexcept

Creates new instance ostream event lister with ostream specified.

Parameters
ossotream where evnets are writting.

Member Function Documentation

§ on_class_cleanup_end()

virtual void xtd::tunit::event_listener::on_class_cleanup_end ( const xtd::tunit::class_event_args e) const
inlinevirtualinherited

Occurs when class cleanup is ended.

Parameters
class_event_argsContains class event parameters.

§ on_class_cleanup_start()

virtual void xtd::tunit::event_listener::on_class_cleanup_start ( const xtd::tunit::class_event_args e) const
inlinevirtualinherited

Occurs when class cleanup is started.

Parameters
class_event_argsContains class event parameters.

§ on_class_end()

virtual void xtd::tunit::event_listener::on_class_end ( const xtd::tunit::class_event_args e) const
inlinevirtualinherited

Occurs when class is ended.

Parameters
class_event_argsContains class event parameters.

§ on_class_initialize_end()

virtual void xtd::tunit::event_listener::on_class_initialize_end ( const xtd::tunit::class_event_args e) const
inlinevirtualinherited

Occurs when class initialize is ended.

Parameters
class_event_argsContains class event parameters.

§ on_class_initialize_start()

virtual void xtd::tunit::event_listener::on_class_initialize_start ( const xtd::tunit::class_event_args e) const
inlinevirtualinherited

Occurs when class initialize is started.

Parameters
class_event_argsContains class event parameters.

§ on_class_start()

virtual void xtd::tunit::event_listener::on_class_start ( const xtd::tunit::class_event_args e) const
inlinevirtualinherited

Occurs when class is started.

Parameters
class_event_argsContains class_event parameters.

§ on_test_aborted()

void xtd::tunit::ostream_event_listener::on_test_aborted ( const xtd::tunit::test_event_args e) const
inlineoverridevirtual

Occurs when test is aborted.

Parameters
test_event_argsContains test event parameters.

Reimplemented from xtd::tunit::event_listener.

§ on_test_cleanup_end()

virtual void xtd::tunit::event_listener::on_test_cleanup_end ( const xtd::tunit::test_event_args e) const
inlinevirtualinherited

Occurs when test cleanup is ended.

Parameters
test_event_argsContains test event parameters.

§ on_test_cleanup_start()

virtual void xtd::tunit::event_listener::on_test_cleanup_start ( const xtd::tunit::test_event_args e) const
inlinevirtualinherited

Occurs when test cleanup is started.

Parameters
test_event_argsContains test event parameters.

§ on_test_end()

virtual void xtd::tunit::event_listener::on_test_end ( const xtd::tunit::test_event_args e) const
inlinevirtualinherited

Occurs when test is ended.

Parameters
test_event_argsContains test event parameters.

§ on_test_failed()

void xtd::tunit::ostream_event_listener::on_test_failed ( const xtd::tunit::test_event_args e) const
inlineoverridevirtual

Occurs when test is failed.

Parameters
test_event_argsContains test event parameters.

Reimplemented from xtd::tunit::event_listener.

§ on_test_ignored()

void xtd::tunit::ostream_event_listener::on_test_ignored ( const xtd::tunit::test_event_args e) const
inlineoverridevirtual

Occurs when test is ignored.

Parameters
test_event_argsContains test event parameters.

Reimplemented from xtd::tunit::event_listener.

§ on_test_initialize_end()

virtual void xtd::tunit::event_listener::on_test_initialize_end ( const xtd::tunit::test_event_args e) const
inlinevirtualinherited

Occurs when test initialize is ended.

Parameters
test_event_argsContains test event parameters.

§ on_test_initialize_start()

virtual void xtd::tunit::event_listener::on_test_initialize_start ( const xtd::tunit::test_event_args e) const
inlinevirtualinherited

Occurs when test initialize is ended.

Parameters
test_event_argsContains test event parameters.

§ on_test_start()

virtual void xtd::tunit::event_listener::on_test_start ( const xtd::tunit::test_event_args e) const
inlinevirtualinherited

Occurs when test initialize is started.

Parameters
test_event_argsContains test event parameters.

§ on_test_succeed()

void xtd::tunit::ostream_event_listener::on_test_succeed ( const xtd::tunit::test_event_args e) const
inlineoverridevirtual

Occurs when test is succeed.

Parameters
test_event_argsContains test event parameters.

Reimplemented from xtd::tunit::event_listener.

§ on_unit_test_cleanup_end()

virtual void xtd::tunit::event_listener::on_unit_test_cleanup_end ( const xtd::tunit::tunit_event_args e) const
inlinevirtualinherited

Occurs when unit test cleanup is ended.

Parameters
tunit_event_argsContains unit test event parameters.

§ on_unit_test_cleanup_start()

virtual void xtd::tunit::event_listener::on_unit_test_cleanup_start ( const xtd::tunit::tunit_event_args e) const
inlinevirtualinherited

Occurs when unit test is started.

Parameters
tunit_event_argsContains unit test event parameters.

§ on_unit_test_end()

void xtd::tunit::ostream_event_listener::on_unit_test_end ( const xtd::tunit::tunit_event_args e) const
inlineoverridevirtual

Occurs when unit test is ended.

Parameters
tunit_event_argsContains unit test event parameters.

Reimplemented from xtd::tunit::event_listener.

§ on_unit_test_initialize_end()

virtual void xtd::tunit::event_listener::on_unit_test_initialize_end ( const xtd::tunit::tunit_event_args e) const
inlinevirtualinherited

Occurs when unit test initalize is ended.

Parameters
tunit_event_argsContains unit test event parameters.

§ on_unit_test_initialize_start()

virtual void xtd::tunit::event_listener::on_unit_test_initialize_start ( const xtd::tunit::tunit_event_args e) const
inlinevirtualinherited

Occurs when unit test initialize is ended.

Parameters
tunit_event_argsContains unit test event parameters.

§ on_unit_test_start()

void xtd::tunit::ostream_event_listener::on_unit_test_start ( const xtd::tunit::tunit_event_args e) const
inlineoverridevirtual

Occurs when unit test cleanup is started.

Parameters
tunit_event_argsContains unit test event parameters.

Reimplemented from xtd::tunit::event_listener.


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