[Boost.Test] How to reuse test results?

I tried to use BOOST_FIXTURE_TEST_SUITE to use a fixture in multiple tests. Of course it works fine yet the behavior was not as I expected. What I was expecting which I learned from testing was that the fixture was setup and torn down on each test rather than when the suite ended. In my present problem I have a class which represents the initialization steps of an simulation. There are various algorithms that need to be executed and the results of one can be used in another. So what I was hoping to learn how to do is have a fixture which I can use in the tests of a suite which is only setup and torn down once respectively.
So something like:
#define BOOST_TEST_MODULE long_life_fixture
#include

Torri, Stephen CIV NSWCDD, W15
Indeed test suite level fixtures are intended to automate setup/tear-down procedures for all test cases with the test. What you were looking here I might call per-test suite fixture and it is not directly supported by Boost.Test macro. What you can do to imitate the behavior, is to implement the first test case as a setup and last one as tear-down.
The is frowned upon in proper TDD approach. Your test cases should be independent. You are better of running whole procedure from start to the point A in one test case, from start to the point B after A in another and so on. Gennadiy
participants (2)
-
Gennadiy Rozental
-
Torri, Stephen CIV NSWCDD, W15