Unit Test Framework - strange behaviour of test_unit::depends_on

Hi there, Why the code below does not run test case TC_TestCase and reports that the whole test suite is skipped? Nothing is executed from my code. If the line /*1*/ is commented out, then behaviour is as expected. I use MSVC 2008 SP1 Win32, boost 1.36.0 or boost 1.37.0. I have to admit that test_unit::depends_on is not documented. Unit test framework is changed in 1.37.0 but changes are not documented anywhere. Regards, Alexander ----------- code in question ------ #include <boost/test/included/unit_test.hpp> using boost::unit_test::test_suite; void Dependency() { BOOST_MESSAGE( "Dependency!" ); BOOST_CHECK( 1 ); } void TC_TestCase() { BOOST_MESSAGE( "A test case!" ); BOOST_CHECK( 1 ); } test_suite* init_unit_test_suite( int argc, char* argv[] ) { test_suite* ts = BOOST_TEST_SUITE( "Test_Test" ); ts->add( BOOST_TEST_CASE( &TC_TestCase ) ); /*1*/ ts->depends_on( BOOST_TEST_CASE( &Dependency ) ); return ts; } -------- end code in question ------ ------------ output ----------- Running 1 test case... Entering test suite "Master Test Suite" Test suite "Test_Test"is skipped Leaving test suite "Master Test Suite" *** No errors detected ---------- end output -----------

Me here wrote:
Hi there,
Why the code below does not run test case TC_TestCase and reports that the whole test suite is skipped? Nothing is executed from my code. If the line /*1*/ is commented out, then behaviour is as expected.
Because test suite Test_Test depends on test unit Dependency, which is never run, as if it was skipped. If dependency is skipped, test unit is skipped as well.
I have to admit that test_unit::depends_on is not documented. Unit test framework is changed in 1.37.0 but changes are not documented anywhere.
Please open a ticket. This should be fixed. Gennadiy
participants (2)
-
Gennadiy Rozental
-
Me here