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

Class results_collector_t

boost::unit_test::results_collector_t — Collects and combines the test results.

Synopsis

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


class results_collector_t : public boost::unit_test::test_observer {
public:

  // public member functions
  virtual void test_start(counter_t, test_unit_id);
  virtual void test_unit_start(test_unit const &);
  virtual void test_unit_finish(test_unit const &, unsigned long);
  virtual void test_unit_skipped(test_unit const &, const_string);
  virtual void test_unit_aborted(test_unit const &);
  virtual void test_unit_timed_out(test_unit const &);
  virtual void assertion_result(unit_test::assertion_result);
  virtual void exception_caught(execution_exception const &);
  virtual int priority();
  test_results const & results(test_unit_id) const;
  virtual void test_finish();
  virtual void test_aborted();
  virtual void test_unit_skipped(test_unit const &);
};

Description

This class collects and combines the results of the test unit during the execution of the test tree. The results_collector_t::results() function combines the test results on a subtree of the test tree.

See Also: boost::unit_test::test_observer

results_collector_t public member functions

  1. virtual void test_start(counter_t, test_unit_id);
    Called before the framework starts executing the test cases.

  2. virtual void test_unit_start(test_unit const &);
    Called before the framework starts executing a test unit.

  3. virtual void test_unit_finish(test_unit const &, unsigned long);
    Called at each end of a test unit.

  4. virtual void test_unit_skipped(test_unit const &, const_string);
  5. virtual void test_unit_aborted(test_unit const &);
    Called when a test unit indicates a fatal error.

    A fatal error happens when

    • a strong assertion (with REQUIRE) fails, which indicates that the test case cannot continue

    • an unexpected exception is caught by the Boost.Test framework

  6. virtual void test_unit_timed_out(test_unit const &);
    Called when the test timed out.

    This function is called to signal that a test unit (case or suite) timed out. A valid test unit is available through boost::unit_test::framework::current_test_unit

  7. virtual void assertion_result(unit_test::assertion_result);
  8. virtual void exception_caught(execution_exception const &);
    Called when an exception is intercepted.

    In case an exception is intercepted, this call happens before the call to test_unit_aborted in order to log additional data about the exception.

  9. virtual int priority();
    The priority indicates the order at which this observer is initialized and tore down in the UTF framework. The order is lowest to highest priority.
  10. test_results const & results(test_unit_id tu_id) const;
    Results access per test unit.

    Parameters:

    tu_id

    id of a test unit

  11. virtual void test_finish();
    Called after the framework ends executing the test cases.
    [Note] Note

    The call is made with a reversed priority order.

  12. virtual void test_aborted();
    Called when a critical error is detected.

    The critical errors are mainly the signals sent by the system and caught by the Boost.Test framework. Since the running binary may be in incoherent/instable state, the test execution is aborted and all remaining tests are discarded.

    [Note] Note

    may be called before test_observer::test_unit_finish()

  13. virtual void test_unit_skipped(test_unit const &);
    backward compatibility

PrevUpHomeNext