xtd 1.0.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.

Public Constructors

 ostream_unit_test (std::ostream &os) noexcept
 Create a new console unit test with ostream specified.

Public Properties

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

Public Methods

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

Additional Inherited Members

 unit_test (xtd::uptr< xtd::tunit::event_listener > event_listener) noexcept
 Initializes a new instance of xtd::tunit::unit_test with specified xtd::tunit::event_listener.
auto repeat_iteration () const noexcept -> xtd::int32
 Gets the repeat iteration number. A number between 0 and xtd::tunit::unit_test::repeat_iteration_count.
auto repeat_iteration_count () const noexcept -> xtd::int32
 Gets the repeat iteration count.
auto repeat_tests () const noexcept -> bool
 Gets a boolean indictaes if there is repeat tests.
auto test_cases_count () const noexcept -> xtd::usize
 Gets the test cases count.
auto test_count () const noexcept -> xtd::usize
 Gets the test count.
auto aborted_test_count () const noexcept -> xtd::usize
 Gets the aborted test count.
auto aborted_test_names () const noexcept -> xtd::array< xtd::string >
 Gets the array of aborted test names.
auto elapsed_time () const noexcept -> xtd::time_span
 Gets the elapsed time for the execution of all tests in the unit test.
auto ignored_test_count () const noexcept -> xtd::usize
 Gets the ignored test count.
auto ignored_test_names () const noexcept -> xtd::array< xtd::string >
 Gets the array of ignored test names.
auto failed_test_count () const noexcept -> xtd::usize
 Gets the failed test count.
auto failed_test_names () const noexcept -> xtd::array< xtd::string >
 Gets the array of failed test names.
auto succeed_test_count () const noexcept -> xtd::usize
 Gets the succeed test count.
auto succeed_test_names () const noexcept -> xtd::array< xtd::string >
 Gets the array of succeed test names.
auto run () noexcept -> xtd::int32
 Runs all tests in this unit_test object and prints the result.

Constructor & Destructor Documentation

◆ ostream_unit_test()

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.
Remarks
The arguments of the unit test application are done with xtd::environment::get_command_line_args method.

Member Function Documentation

◆ ostream()

auto xtd::tunit::ostream_unit_test::ostream ( ) -> std::ostream &
nodiscard

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.

◆ count_tests()

auto xtd::tunit::ostream_unit_test::count_tests ( xtd::int32 count) -> xtd::int32
nodiscardoverridevirtual

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()

auto xtd::tunit::ostream_unit_test::list_tests ( const xtd::array< xtd::string > & tests) -> xtd::int32
nodiscardoverridevirtual

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.

◆ parse_arguments()

auto xtd::tunit::ostream_unit_test::parse_arguments ( const xtd::array< xtd::string > & args) -> bool
nodiscardoverridevirtual

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()

auto xtd::tunit::ostream_unit_test::write_help ( ) -> void

Write usage help on the ostream of this instance.


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