Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Test] Unable to perform init at startup
From: Adam Nielsen (a.nielsen_at_[hidden])
Date: 2013-12-22 04:08:46

> terminate called after throwing an instance of 'std::runtime_error'
> what(): can't use testing tools before framework is initialized
> I am assuming this means I need to wait with the construction of my
> factory class until Boost.Test is ready, but I am unsure how to do
> this.

I ended up working around this by creating a wrapper function. This
function calls init() once (if it has not already been called) followed
by the intended test.

I wrap all my test functions in this wrapper, this way it does not
matter which test is called first, the init code will always run first.

I think there is probably room in Boost.Test for some way of running
code during init (which uses BOOST_REQUIRE_* etc) for those situations
where factory classes must be created prior to the tests which use
them, and when the tests are manually registered.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at