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

Tests naming

Acceptable characters for names

The Unit Test Framework is flexible on the naming the test units (test cases/suites) and it is possible to use a wide variety of characters. However there are scenarios where the name of a test unit may collide with other features of the Unit Test Framework. For instance:

To prevent any conflicting declaration, the Unit Test Framework sanitizes the name given to a test unit (case or suite), prior to adding the test to the test tree. Any conflicting character is replaced by an underscore '_'.

[Note] Note

Spaces are not considered as special chars and are preserved, except for the leading and trailing spaces which are removed.

[Note] Note

The sanitization of the test unit names has been introduced in Boost 1.67.

Constraints on test names

The Unit Test Framework considers an error if two sibling test cases have the same name. This consistency check is performed at runtime and is not sensitive to test filtering.

For test-cases registered automatically, and within the same compilation unit, a compilation error should be raised by the compiler in case of name conflict. For manual registration of test cases and in case of conflicts, the too BOOST_TEST_CASE_NAME may be used.

The data driven tests are automatically created in an isolated test-suite and with a name that is indexed on the sample.

[Note] Note

This constraints does not apply to test-suites: Opening/closing a test-suite declaration adds the test-cases to an existing or newly created test-suite of that name.


PrevUpHomeNext