|> The Unit Test Framework > Testing tools >|
Table of Contents
The UTF's supplies a toolbox of testing tools to ease creation and maintenance of test programs and
provide a uniform error reporting mechanism. The toolbox supplied in most part in a form of macro and function
declarations. While the functions can be called directly, the usual way to use testing tools is via convenience
macros. All macros arguments are calculated once, so it's safe to pass complex expressions in their place.
All tools automatically supply an error location: a file name and a line number. The testing tools are intended
for unit test code rather than library or production code, where throwing exceptions, using assert(),
BOOST_STATIC_ASSERT() may be more suitable
ways to detect and report errors. For list of all supplied testing tools and usage examples see the reference.
All the tools are supplied in three flavors(levels): WARN, CHECK and
REQUIRE. For example:
BOOST_REQUIRE_EQUAL. If an assertion designated by
the tool passes, confirmation message can be printed in log output. If an assertion designated by the tool failed, depending on the level following
Table 5. Testing tools levels differences
|Level||Test log content||Errors counter||Test execution|
fatal error in
Regularly you should use CHECK level tools to implement your assertions. You can use WARN level tools to validate aspects less important then correctness: performance, portability, usability etc. You should use REQUIRE level tools only if continuation of the test case doesn't make sense if this assertions fails.