Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Test module initialization

Original initialization function
Alternative initialization function
Initialization function signature access
Automated generation

There are two tasks that you may need to perform before actual testing can start:

The function dedicated for this purpose is called the test module initialization function. Alternatively you can employ global fixtures, covered in details, including differences in two approaches, in the fixtures section.

The UTF requires you to implement the test module initialization function. The test runner supplied with the static library or single-header variants of the UTF requires the specific function specification. The test runner supplied with the dynamic library variant of the UTF requires the specific initialization function signature only.

[Warning] Warning

TO FIX: specific specification

For many test modules you don't need to do any custom initialization and test tree construction is automated. In this case you don't really need the initialization function and the UTF provides a way to automatically generate an empty one for you.

Original design of the UTF supported the manual test tree construction only. Later versions introduced the automated registration of test units. In later versions of the UTF the original initialization function specification became inconvenient and unnecessary unsafe. So the alternative initialization function specification was introduced. This change is not backward compatible. The test runners supplied with the static library and single-header variants of the UTF by default still require original initialization function specification, but support <link linkend="utf.compilation.flags">compilation flags</link> that switch to the alternative one. The test runner supplied with dynamic library variant of the UTF requires new specification and doesn't support original one. The plan is to deprecate the original initialization function specification in one of the future releases and ultimately to stop supporting it.

The initialization function invocation is monitored by the UTF the same way as all the test cases. An unexpected exception or system error detected during initialization function invocation is treated as initialization error and is reported as such.


PrevUpHomeNext