
Ovanes Markarian wrote:
Hi!
The fixture would need to look something like this:
struct F { F(string db_name) { connect to db_name } ~F() { disconnect from db_name } };
Now, the Boost.Test documentation tells me that a fixture is supposed to be used like this: BOOST_FIXTURE_TEST_SUITE( s, F )
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?
TIA, Markus http://lists.boost.org/mailman/listinfo.cgi/boost-users
The simplest approach would be: namespace { struct ConnectToDB_X : F { ConnectToDB_X() : F(db_nameX) {} };
BOOST_FIXTURE_TEST_SUITE( s, ConnectToDB_X );
I guess I forgot to mention that I need to configure the fixture at runtime. The DB name (which is actually a connection string) is passed to the test as a command line parameter. Markus