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_org... 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_refer...) 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_org...) 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