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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Class test_results

boost::unit_test::test_results — Collection of attributes constituting test unit results.

Synopsis

// In header: <boost/test/results_collector.hpp>


class test_results {
public:
  // construct/copy/destruct
  test_results();

  // public member functions
  typedef BOOST_READONLY_PROPERTY(counter_t, 
                                  (results_collector_t)(test_results)(results_collect_helper));
  typedef BOOST_READONLY_PROPERTY(bool, 
                                  (results_collector_t)(test_results)(results_collect_helper));
  bool passed() const;
  bool skipped() const;
  bool aborted() const;
  int result_code() const;
  void operator+=(test_results const &);
  void clear();

  // public data members
  counter_prop p_test_suites;  // Number of test suites. 
  counter_prop p_assertions_passed;  // Number of successful assertions. 
  counter_prop p_assertions_failed;  // Number of failing assertions. 
  counter_prop p_warnings_failed;  // Number of warnings. 
  counter_prop p_expected_failures;
  counter_prop p_test_cases_passed;  // Number of successfull test cases. 
  counter_prop p_test_cases_warned;  // Number of warnings in test cases. 
  counter_prop p_test_cases_failed;  // Number of failing test cases. 
  counter_prop p_test_cases_skipped;  // Number of skipped test cases. 
  counter_prop p_test_cases_aborted;  // Number of aborted test cases. 
  counter_prop p_test_cases_timed_out;  // Number of timed out test cases. 
  counter_prop p_test_suites_timed_out;  // Number of timed out test suites. 
  counter_prop p_duration_microseconds;  // Duration of the test in microseconds. 
  bool_prop p_aborted;  // Indicates that the test unit execution has been aborted. 
  bool_prop p_skipped;  // Indicates that the test unit execution has been skipped. 
  bool_prop p_timed_out;  // Indicates that the test unit has timed out. 
};

Description

This class is a collection of attributes describing a test result.

The attributes presented as public properties on an instance of the class. In addition summary conclusion methods are presented to generate simple answer to pass/fail question

test_results public construct/copy/destruct

  1. test_results();

test_results public member functions

  1. typedef BOOST_READONLY_PROPERTY(counter_t, 
                                    (results_collector_t)(test_results)(results_collect_helper));
    Type representing counter like public property.
  2. typedef BOOST_READONLY_PROPERTY(bool, 
                                    (results_collector_t)(test_results)(results_collect_helper));
    Type representing boolean like public property.
  3. bool passed() const;
    Returns true if test unit passed.
  4. bool skipped() const;
    Returns true if test unit skipped.

    For test suites, this indicates if the test suite itself has been marked as skipped, and not if the test suite contains any skipped test.

  5. bool aborted() const;
    Returns true if the test unit was aborted (hard failure)
  6. int result_code() const;
    Produces result code for the test unit execution.

    This methhod return one of the result codes defined in boost/cstdlib.hpp

    Returns:

    • boost::exit_success on success,

    • boost::exit_exception_failure in case test unit was aborted for any reason (including uncaught exception)

    • and boost::exit_test_failure otherwise

  7. void operator+=(test_results const &);
    Combines the results of the current instance with another.

    Only the counters are updated and the p_aborted and p_skipped are left unchanged.

  8. void clear();
    Resets the current state of the result.

PrevUpHomeNext