I'm using boost.test as test suite. I want to know if is possible make some prerequisite for test. For example
uniqut_ptr< MyClass > g_class;
BOOST_AUTO_TEST_CASE( test1 )
{
BOOST_REQUIRE_NO_THROW( g_class = CreateMyClass() );
}
BOOST_AUTO_TEST_CASE( test2 )
{
// This test need the test1 as passed
BOOST_REQUIRE( g_class->doSomething() );
}
In this case if test1 fail program will crash in test2. I know that I can add BOOST_REQUIRE( g_class )
at the begining of each test. But is there another way?