Home > The Unit Test Framework > User's guide > Test organization > Test suite >

Test suite

If you consider test cases as leaves on the test tree, the test suite can be considered as branch and the master test suite as a trunk. Unlike real trees though, our tree in many cases consists only of leaves attached directly to the trunk. This is common for all test cases to reside directly in the master test suite. If you do want to construct a hierarchical test suite structure the UTF provides both manual and automated test suite creation and registration facilities:

Test unit registration interface

The UTF models the notion of test case container - test suite - using class boost::unit_test::test_suite. For complete class interface reference check advanced section of this documentation. Here you should only be interested in a single test unit registration interface:

void test_suite::add( test_unit* tc, counter_t expected_failures = 0, int timeout = 0 );

The first parameter is a pointer to a newly created test unit. The second optional parameter - expected_failures - defines the number of test assertions that are expected to fail within the test unit. By default no errors are expected.

[Caution] Caution

Be careful when supplying a number of expected failures for test suites. By default the UTF calculates the number of expected failures in test suite as the sum of appropriate values in all test units that constitute it. And it rarely makes sense to change this.

The third optional parameter - timeout - defines the timeout value for the test unit. As of now the UTF isn't able to set a timeout for the test suite execution, so this parameter makes sense only for test case registration. By default no timeout is set. See the method boost::execution_monitor::execute for more details about the timeout value.

To register group of test units in one function call the boost::unit_test::test_suite provides another add interface covered in the advanced section of this documentation.