Home > The Unit Test Framework > User's guide > Runtime configuration > Run by name
PrevNext

Running specific test units selected by their name

In regular circumstances test module execution initiates testing of all test units manually or automatically registered in master test suite. The UTF provides an ability to run specific set of test unit as well. It can be single test case, single test suite or some combination of test cases and suites. The tests units to run are selected by the runtime parameter run_test. In the following examples I select tests to run using command line arguments, but the same filter expression can be used as an appropriate environment variable value.

Filter expressions are specified in a form a/b/c, where a, b and c are filters for corresponding levels of test tree. Symbol '*' can be used at the beginning, at the end and as the level filter itself as an asterisk. Symbol ',' is used to create list of test units residing on the same level in test tree.

Let's consider following test module consisting from several test suites and test cases.

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

BOOST_AUTO_TEST_CASE( testA )
{
}

BOOST_AUTO_TEST_CASE( testB )
{
}

BOOST_AUTO_TEST_SUITE( s1 )

BOOST_AUTO_TEST_CASE( test1 )
{
}

BOOST_AUTO_TEST_CASE( lest2 )
{
}

BOOST_AUTO_TEST_SUITE_END()

BOOST_AUTO_TEST_SUITE( s2 )

BOOST_AUTO_TEST_CASE( test1 )
{
}

BOOST_AUTO_TEST_CASE( test11 )
{
}

BOOST_AUTO_TEST_SUITE( in )

BOOST_AUTO_TEST_CASE( test )
{
}

BOOST_AUTO_TEST_SUITE_END()

BOOST_AUTO_TEST_SUITE_END()

PrevUpHomeNext