Boost logo

Boost Users :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2006-02-08 10:01:06


> Hello alltogether,
>
> it seems, that the a test_case-failure (BOOST_ERROR("")), skips only the
> actual
> test case, but all following tests are executed. Is that possible ? ... or
> am I
> doing something wrong?

Yes. Non system-fatal error (memory access violation for example) won't
cause the testing to halt. Only the affected test case is aborted.

>
> Here my code:
> [...]
> boost::shared_ptr<testTestExecutor> aInstance( new testTestExecutor );
>
> // here happens a failure
> pTestSuite->add(
> BOOST_CLASS_TEST_CASE(&testTestExecutor::setUp, aInstance));
>
> // but this is also executed
> pTestSuite->add(
> BOOST_CLASS_TEST_CASE(&testTestExecutor::testConstruction, aInstance));
>
> pTestSuite->add(
> BOOST_CLASS_TEST_CASE( &testTestExecutor::testTestExecutorMethode,
> aInstance));
> [...]
>
>
> Can I configure that behaviour ?

One option is to use test case dependency feature. For example if you have
setup test case and you prefer failure in this test case prevent other to be
executed you could do:

test_case* setup_tc = BOOST_CLASS_TEST_CASE(&testTestExecutor::setUp,
aInstance);
test_case* const_tc =
BOOST_CLASS_TEST_CASE(&testTestExecutor::testConstruction, aInstance);

const_tc->depends_on( setup_tc );

If you have multiple Test cases that depend on it you could do it all in one
shot with extra test suite:

test_case* setup_tc = BOOST_CLASS_TEST_CASE(&testTestExecutor::setUp,
aInstance);
test_siute* ts = BOOST_TEST_SUITE("PostSetup");

ts->depends_on( depends_on );

Now add all test cases to the "PostSetup" test suite.

Gennadiy


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net