Boost C++ Libraries 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.

Test cases

Test cases without parameters
Data-driven test cases
Dataset interface
Dataset creation and delayed creation
Declaring and registering test cases with datasets
Operations on dataset
Grid (Cartesian products)
Datasets generators
Template test cases
Parametrized test cases

A test case is a unit of execution that is run by the test runner. It contains instructions and assertions, and its execution is monitored by the Unit Test Framework. Information about the execution is recorded, and a log/report is produced.

The test runner should be informed of the test case in order to run it: the test case should be registered for its inclusion into the test tree.

The Unit Test Framework covers the following test case scenarios:

The test case have a different declaration APIs for each of the above scenarios. Preferred APIs will declare the test case and register it automatically in a test tree without a necessity to perform manual registration.

Manual registration

While automatic registration is preferred test case declaration API, it is also possible to declare tests manually. For this APIs, Unit Test Framework opted for a least intrusive design based on generic callback approach, which signatures depends on the king of test case being declared.

The single test module may mix both automated and manual test case registration. In other words, within the same test module you can have both test cases implemented remotely and registered manually in the test module initialization function and test cases that are registered automatically at implementation point.

[Caution] Caution

The design of manual test case declaration API in Unit Test Framework assumes the test case implementation (test function body) and test case creation/registration points are remote. As a result you may forget to register the test case and it's never going to be executed, even though it's present in test file.

You need to be sure you exhausted all possible ways to employ automatic registration APIs first before you opt to use manual registration. Specifically: