Boost logo

Boost Users :

Subject: Re: [Boost-users] [test] Passing parameters to fixtures
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2008-09-15 14:08:37


Markus Schöpflin <markus.schoepflin <at> comsoft.de> writes:

[...]

> Up to now (using an old version of Boost.Test) I was creating a
> test suite (by deriving from test_suite) and performed the
> connection handling during construction/destruction of the
> customized test suite.

[...]
 
> Now, the Boost.Test documentation tells me that a fixture
> is supposed to be used like this: BOOST_FIXTURE_TEST_SUITE( s, F )

Unfortunately this is not what you want. This suite level fixture -
meaning it's applied to every test case within the suite. What you
are looking for is "per suite" fixture. This is the only type of
fixture which is not implemented yet.
 
> So there doesn't seem to be a way of passing parameters to
> the constructor of the fixture. Is there any? Or is there
> any other way to obtain a parametrized fixture? Or should
> I just keep on using customized test suites?

Unless I've broken something, it should continue to work.
On the other hand if you need yo configure DB connection
only once per test module, you can use BOOST_TEST_GLOBAL_FIXTURE.
You can access CLAs through master test suite interface.

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