Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards


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 Unit Test Framework support simple text progress display, implemented based on



The progress display output is enabled using the Unit Test Framework parameter show_progress.

The Unit Test Framework has no ability to estimate how long (in time duration) the test case execution is going to take and the manual test progress update is not supported at this point. The Unit Test Framework 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& )
Example: 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_TEST( true /* test assertion */ );

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

  return 0;


> example --show_progress=yes --log_level=nothing

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

*** No errors detected

[17] The Unit Test Framework interfaces allow implementing an advanced GUI based test runner with arbitrary progress display controls