xtd 0.2.0
Loading...
Searching...
No Matches
xtd::tunit::ostream_unit_test Class Reference
Inheritance diagram for xtd::tunit::ostream_unit_test:
xtd::tunit::unit_test xtd::tunit::console_unit_test

Definition

The ostream_unit_test class is ostream unit test interface.

Namespace
xtd::tunit
Library
xtd.tunit
Remarks
All messages are written on the specified ostream.
Examples
ostream_unit_test.cpp.

Public Constructors

 ostream_unit_test (std::ostream &os) noexcept
 Create a new console unit test with ostream specified.
 
 ostream_unit_test (std::ostream &os, int argc, char *argv[])
 Create a new console unit test with ostream specified, argv specified and argc specified.
 

Public Properties

std::ostream & ostream ()
 Gets the ostream used by this instance.
 

Public Methods

int count_tests (int32 count) override
 Counts the test names contained in the specified tests.
 
int list_tests (const std::vector< xtd::ustring > &tests) override
 Lists the test names contained in the specified tests.
 
bool parse_arguments (const std::vector< xtd::ustring > &args) override
 Parses the specified arguments.
 
void write_help ()
 Write usage help on the ostream of this instance.
 

Additional Inherited Members

- Public Member Functions inherited from xtd::tunit::unit_test
 unit_test (std::unique_ptr< xtd::tunit::event_listener > event_listener) noexcept
 Initializes a new instance of xtd::tunit::unit_test with specified xtd::tunit::event_listener.
 
 unit_test (std::unique_ptr< xtd::tunit::event_listener > event_listener, int argc, char *argv[]) noexcept
 Initializes a new instance of xtd::tunit::unit_test with specified xtd::tunit::event_listener, argument counts and arguments array.
 
int32 repeat_iteration () const noexcept
 Gets the repeat iteration number. A number between 0 and xtd::tunit::unit_test::repeat_iteration_count.
 
int32 repeat_iteration_count () const noexcept
 Gets the repeat iteration count.
 
bool repeat_tests () const noexcept
 Gets a boolean indictaes if there is repeat tests.
 
size_t test_cases_count () const noexcept
 Gets the test cases count.
 
size_t test_count () const noexcept
 Gets the test count.
 
size_t aborted_test_count () const noexcept
 Gets the aborted test count.
 
std::vector< xtd::ustringaborted_test_names () const noexcept
 Gets the array of aborted test names.
 
xtd::time_span elapsed_time () const noexcept
 Gets the elapsed time for the execution of all tests in the unit test.
 
size_t ignored_test_count () const noexcept
 Gets the ignored test count.
 
std::vector< xtd::ustringignored_test_names () const noexcept
 Gets the array of ignored test names.
 
size_t failed_test_count () const noexcept
 Gets the failed test count.
 
std::vector< xtd::ustringfailed_test_names () const noexcept
 Gets the array of failed test names.
 
size_t succeed_test_count () const noexcept
 Gets the succeed test count.
 
std::vector< xtd::ustringsucceed_test_names () const noexcept
 Gets the array of succeed test names.
 
int32 run ()
 Runs all tests in this unit_test object and prints the result.
 
- Protected Member Functions inherited from xtd::tunit::unit_test

Constructor & Destructor Documentation

◆ ostream_unit_test() [1/2]

xtd::tunit::ostream_unit_test::ostream_unit_test ( std::ostream &  os)
explicitnoexcept

Create a new console unit test with ostream specified.

Parameters
osThe ostream to write events.

◆ ostream_unit_test() [2/2]

xtd::tunit::ostream_unit_test::ostream_unit_test ( std::ostream &  os,
int  argc,
char *  argv[] 
)

Create a new console unit test with ostream specified, argv specified and argc specified.

Parameters
osThe ostream to write events.
argcArgument count from main method.
argvArguments array from main method.

Member Function Documentation

◆ count_tests()

int xtd::tunit::ostream_unit_test::count_tests ( int32  count)
overridevirtual

Counts the test names contained in the specified tests.

Parameters
countThe tests count.
Returns
The xtd::tunit::settings::exit_status value.
Remarks
This method does nothing by default. The inheritor must overload this method to act as it wants when the unit_lest is asked for the test list.
This method is typically used to display the list of tests in a stream, or whatever. It depends on the implementation chosen by the inheritor.

Reimplemented from xtd::tunit::unit_test.

◆ list_tests()

int xtd::tunit::ostream_unit_test::list_tests ( const std::vector< xtd::ustring > &  tests)
overridevirtual

Lists the test names contained in the specified tests.

Parameters
testsThe list of test names.
Returns
The xtd::tunit::settings::exit_status value.
Remarks
This method does nothing by default. The inheritor must overload this method to act as it wants when the unit_lest is asked for the test list.
This method is typically used to display the list of tests in a stream, or whatever. It depends on the implementation chosen by the inheritor.

Reimplemented from xtd::tunit::unit_test.

◆ ostream()

std::ostream & xtd::tunit::ostream_unit_test::ostream ( )

Gets the ostream used by this instance.

Returns
The ostream used by this instance.
Warning
Used it only if you need to write specific user messages. If you change or redirect it when tests running, the unit test output result will be indeterminate.

◆ parse_arguments()

bool xtd::tunit::ostream_unit_test::parse_arguments ( const std::vector< xtd::ustring > &  args)
overridevirtual

Parses the specified arguments.

Parameters
Thearguments to parse.
Returns
true the execution process stops immediately after the analysis of the arguments; otherwise false the execution process continues its execution.
Remarks
This method can be overloaded by the heirs. It is typically in this method that the heirs can react to their own arguments. Like for example display a helper when the -help argument is passed.

Reimplemented from xtd::tunit::unit_test.

◆ write_help()

void xtd::tunit::ostream_unit_test::write_help ( )

Write usage help on the ostream of this instance.


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