Test: Skip test from fixture

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Test: Skip test from fixture

Boost - Users mailing list
Hello,

given I have a test with a fixture. How can I skip that test from within the fixture?

Thanks,
Florian

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Test: Skip test from fixture

Boost - Users mailing list
Le 09.05.17 à 11:26, Florian Lindner via Boost-users a écrit :
> Hello,
>
> given I have a test with a fixture. How can I skip that test from within the fixture?
>
> Thanks,
> Florian
>

Hi,

Not sure to understand what you mean: from the fixture itself, you want
to be able to skip the test, means that you have some logic inside your
fixture that determines if you need to run the test or not?

You may use the preconditions decorator:
http://www.boost.org/doc/libs/1_64_0/libs/test/doc/html/boost_test/tests_organization/enabling.html#boost_test.tests_organization.enabling.runtime_run_status

but currently this check is happening before the setup of the fixture is
called (with decorators, see
http://www.boost.org/doc/libs/1_64_0/libs/test/doc/html/boost_test/utf_reference/test_org_reference/decorator_fixture.html)
and this is not possible for the previous fixture API (eg.
http://www.boost.org/doc/libs/1_64_0/libs/test/doc/html/boost_test/tests_organization/test_suite.html#ref_BOOST_AUTO_TEST_SUITE)

For the API with inherited fixture classes, you can just set a boolean
flag inside the fixture class, and check for this flag inside the test
case body to early terminate. For the decorator API, you have to do it
in a different way as the decorator and the test body do not share state.

Raffi

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users