Boost.Test > Components > The Unit Test Framework > Components > The Test Suite
Boost Test logo

The Test Suite


defined in unit_test_suite.hpp

class test_suite : public test_case
    void add( test_case* tc,
              unit_test_counter expected_failures = 0,
              int timeout = 0 );
    ... // Implementation

The Unit Test Framework provides an ability for the user to combine created test cases into a test suite and create a hierarchy of test suites of any depth. To add a test_case to the test_suite use the method test_suite::add(...). The first argument is a pointer to a new test_case, second - expected_failures - defines the amount of Test Tools assertions that are expected to fail in the test case, and third - timeout defines the timeout value for the test case. Note that the expected number of failures is calculated automatically for the test suites, so you do not need to specify them while adding test suites to a hierarchy. See the method execution_monitor::execute(...) for more details about the timeout value. Last two arguments are optional and will not be set if absent. In this case appropriate values defined in the test_case are used.


To create instances of the class test_suite you can use the following macro:

BOOST_TEST_SUITE( test_suite_name ).

BOOST_TEST_SUITE creates an instance of the class test_suite and returns a pointer to it. test_suite is a test_case, that allows to generate a multilevel hierarchy. The only parameter is the name of the test suite. This name is used for test suite identification and for logging.