Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

Header <boost/test/results_reporter.hpp>

defines testing result reporter interfaces

This file defines interfaces that are responsible for results reporting. Interface is presented in a form of free standing function implemented in namespace result_reporter

namespace boost {
  namespace unit_test {
    namespace results_reporter {
      class format;

      // report configuration
      void set_level(report_level);
      void set_stream(std::ostream &);
      void set_format(output_format);
      void set_format(results_reporter::format *);
      std::ostream & get_stream();
      void make_report(report_level l = INV_REPORT_LEVEL, 
                       test_unit_id = INV_TEST_UNIT_ID);
      void confirmation_report(test_unit_id id = INV_TEST_UNIT_ID);
      void short_report(test_unit_id id = INV_TEST_UNIT_ID);
      void detailed_report(test_unit_id id = INV_TEST_UNIT_ID);
    }
  }
}

report configuration

  1. void set_level(report_level l);
    Sets reporting level.

    There are only four possible levels for results report:

    • confirmation report (boost::unit_test::CONFIRMATION_REPORT). This report level only produces short confirmation message about test module pass/fail status

    • short report (boost::unit_test::SHORT_REPORT). This report level produces short summary report for failed/passed assertions and test units.

    • detailed report (boost::unit_test::DETAILED_REPORT). This report level produces detailed report per test unit for passed/failed assertions and uncaught exceptions

    • no report (boost::unit_test::NO_REPORT). This report level produces no results report. This is used for test modules running as part of some kind of continues integration framework

    Parameters:

    l

    report level

  2. void set_stream(std::ostream &);
    Sets output stream for results reporting.

    By default std::cerr is used. Use this function to set a different stream. The framework refers to the stream by reference, so you need to make sure the stream object lifetime exceeds the testing main scope.

  3. void set_format(output_format of);
    Sets one of the predefined formats.

    The framework implements two results report formats:

    Parameters:

    of

    one of the presefined enumeration values for output formats

  4. void set_format(results_reporter::format * f);
    Sets custom report formatter.

    The framework takes ownership of the pointer passed as an argument. So this should be a pointer to a heap allocated object

    Parameters:

    f

    pointer to heap allocated instance of custom report formatter class

  5. std::ostream & get_stream();
    Access to configured results reporter stream.

    Use this stream to report additional information abut test module execution


PrevUpHomeNext