|
Boost Users : |
Subject: Re: [Boost-users] [test] Passing parameters to fixtures
From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2008-09-16 03:08:43
Gennadiy Rozental wrote:
> 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.
Yes, you're right. I assumed that this would give me a per suite fixture.
>> 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.
OK.
> 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.
Interesting. I didn't think about that before. So the global fixture would
parse the command line itself and set up the DB connection in the constructor.
This should give me exactly what I need.
Thanks for your help,
Markus
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