Boost C++ Libraries

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

random
PrevUpHomeNext

Parameter random instructs the Unit Test Framework to execute the test cases in random order. This parameter accepts an optional unsigned integer argument for the seed of the random generator:

  • By default (value 0), the test cases are executed in some specific order defined by the order of test units in the test files, and the dependencies between test units.
  • If the parameter is specified without the argument value, or with value 1, the testing order is randomized based on current time.
  • Alternatively, any positive value greater than 1 will be used as random seed for the run.
[Tip] Tip

in case --random is specified, the value of the seed is logged using BOOST_TEST_MESSAGE, so that it is possible to replay exactly the same sequence of unit test in case of failure. For the seed to be visible in the logs, make sure the proper --log_level is set.

Acceptable values
  • 0 (default): no randomization
  • 1: random seed based on the current time
  • integer value > 1 : seed for the random number generator
Command line syntax
  • --random=<seed>
Environment variable
BOOST_TEST_RANDOM

PrevUpHomeNext