Boost.Test > Components > The Unit Test Framework > Components > The Test Result

# The Test Result

##### Definition

defined in unit_test_result.hpp

##### Synopsis

    class unit_test_result
    {
        static unit_test_result& instance();
        static void              set_report_format( std::string const& reportformat );

        void                     report( std::string const& reportlevel, std::ostream& where_to );
        void                     confirmation_report( std::ostream& where_to );
        void                     short_report( std::ostream& where_to );
        void                     detailed_report( std::ostream& where_to );

        int                      result_code() const;
        bool                     has_passed() const;
    };

##### Description

The Unit Test Framework keeps testing results as the instances of the class unit_test_result. This class is responsible for test result storage, analysis and presentation to the user in output stream. There two formats supported for results presentation: human readable format and XML format. This class provides several methods for the result reporting. In most cases you do not need to use this interface directly. The framework provides a report for overall testing results automatically. You could also configure report format using the framework parameter. See the Framework parameters for details.

- unit_test_result::confirmation_report(...)
  reports the success/failure confirmation message only. The where_to parameter defines target output stream.
- unit_test_result::short_report(...)
  reports testing results for the current test_case. The report includes an amount of passed and failed tests and an amount of passed and failed Test Tools assertions. The where_to parameter defines target output stream.
- unit_test_result::detailed_report(...)
  reports testing results for the current test_case and all test cases it consist of. The where_to parameter defines target output stream.
- unit_test_result::report(...)
  reports testing result based on reportlevel parameter. The where_to parameter defines target output stream.
- unit_test_result::result_code(...)
  provides an access to result code to be returned from main.
- unit_test_result::has_passed(...)
  returns true if all assertions and sub test cases has passed.
- unit_test_result::set_report_format(...)
  sets the format to be used by all instances of class unit_test_result for results report. For the list of acceptable values see the Framework parameters.

##### Construction

The instances of this class are created automatically by the framework for each test case. To access instance of class unit_test_result holding results for the current test case use static method unit_test_result::instance().