Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Test] How to reuse test results?
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2010-09-09 20:46:03


Torri, Stephen CIV NSWCDD, W15 <stephen.torri <at> navy.mil> writes:

>
> 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.

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.

> 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.

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


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