Home > The Unit Test Framework > User's guide > Test Output > Progress display

Test progress display

In case if the test module involves lengthy computation split among multiple test cases you may be interested in progress monitor. The test runners supplied with the UTF support simple text progress display, implemented based on boost::progress_display[5]. The progress display output is enabled using the UTF parameter show_progress.

The UTF has no ability to estimate how long the test case execution is going to take and the manual test progress update is not supported at this point. The UTF tracks the progress on test case level. If you want to see more frequent progress update, you need to split the test into multiple test cases.

In default configuration both test log and test progress outputs are directed into standard output stream. Any test log messages are going to interfere with test progress display. To prevent this you can either set log level to lower level or redirect either test log or test progress output into different stream during test module initialization. Use following interface to redirect test progress output:

boost::unit_test::progress_monitor.set_stream( std::ostream& )

Example33.Progress report for the test module with large amount of test cases

#include <boost/test/included/unit_test.hpp>
using namespace boost::unit_test;


void free_test_function()
    BOOST_CHECK( true /* test assertion */ );


init_unit_test_suite( int argc, char* argv[] ) 
    for( int i=0; i < 10000; i++ )
            add( BOOST_TEST_CASE( &free_test_function ) );

    return 0;

Source code | Show output
> example --show_progress=yes --log_level=nothing

0%   10   20   30   40   50   60   70   80   90   100%

*** No errors detected

[5] UTF