Boost.Test > Components > The Unit Test Framework > Components > The Test Case > Abstract Interface
Boost Test logo

The abstract Test Case interface


defined in unit_test_suite.hpp

class test_case
    void set_timeout( int timeout );
    void set_expected_failures( unit_test_counter exp_fail );
    void depends_on( test_case const* rhs );

    void run();

Abstract class test_case define the test case interface. You could use methods of this interface to manage test case behavior.

Use method test_case:set_timeout(...) to set the timeout value for the test case. See method execution_monitor::execute(...) for more details about the timeout value.

Use method test_case::set_expected_failures(...) to set the expected amount of Test Tools failures in the test case. In most cases it's more convenient to set these parameters while adding this test_case to a test_suite. See the method test_suite::add(...) for more details.

Use method test_case::depends_on(...) to define inter test cases dependencies. You could use this feature to prohibit one test case from running if test case it depends on failed. See unit_test_example3 for example.

Use method test_case::run() to start the test case processing. In majority of the cases you don't need to call this method directly: test cases invokation is done and managed by the framework.


You will never need to create instances of the class test_case.