Home > The Unit Test Framework > User's guide > Test Output > Test log >

Test log output

The test log is produced during the test execution. All entries in the test log are assigned a particular log level. Only the entries with level that exceeds the active log level threshold actually appear in the test log output. Log levels are arranged by the "importance" of the log entries. Here is the list of all levels in order of increasing "importance":

[Note] Note

The active log level works namely as threshold, not as selector. For the given active log level threshold, all test log entries with "importance" higher than threshold are enabled and all test log entries with "importance" below threshold are disabled.

In addition to the levels described above the test log defines two special log levels. The current log level can be set to:

By default the active log level threshold is set to "non fatal error messages" and the test log output is generated in the human readable format. The active log level threshold and the output format can be configured at runtime during a test module invocation and at compile time from within a test module using the test log public interfaces. For example, for automated test module output processing it might be more convenient to use the XML based format.

In most cases The UTF can't provide an exact location, where system error occurs or uncaught C++ exception is thrown from. To be able to pinpoint it as close as possible the UTF keeps track of checkpoints - the location a test module passed through. A test case entrance and exit points, a test tool invocation point the UTF tracks automatically. Any other checkpoints should be entered by you manually. The test log provides two macros for this purpose: BOOST_TEST_CHECKPOINT - to specify a "named" checkpoint and BOOST_TEST_PASSPOINT - to specify an "unnamed" checkpoint.

Logging tool arguments

Most of the testing tools print values of their arguments to the output stream in some form of log statement. If arguments type does not support operator<<(std::ostream&, ArgumentType const&) interface you will get a compilation error. You can either implement above interface or prohibit the testing tools from logging argument values for specified type. To do so use following statement on file level before first test case that includes statement failing to compile:



Try to comment out BOOST_TEST_DONT_PRINT_LOG_VALUE statement and you end up with compile time error.

#define BOOST_TEST_MODULE example
#include <boost/test/included/unit_test.hpp>
#include <utility>


typedef std::pair<int,float> pair_type;


    pair_type p1( 2, 5.5 );
    pair_type p2( 2, 5.501 );

    BOOST_CHECK_EQUAL( p1, p2 );

Source code | Show output
Running 1 test case...
test.cpp(16): error in "test_list": check p1 == p2 failed [ != ]

*** 1 failure detected in test suite "example"

Runtime configuration

The active log level threshold can be configured at runtime using the parameter log_level. The test log output format can be selected using either parameter log_format or the parameter output_format.