Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost] [Test] [1.38] "can't use testing tools before framework is initialized"
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2009-05-17 18:23:51

Greg Christopher wrote:
> Hi,
> I am trying to integrate boost.test into an existing test program with its own framework. Therefore I'd like to use that program's main.

Simplest way to get this is to use dynamic variant of UTF.

> I am currently running into this runtime error when calling BOOST_WARN_MESSAGE(1, "string"). I have tried three different things to avoid this condition:

Where do you call it from? The error indicate exactly what the problem is.

> 1) I declared a TEST_SUITE using the BOOST_AUTO_TEST_SUITE() and END() macros. Probably not what I want because I want my own main to keep control, but figured it would generate a main that would allow the initialization to happen.

This has nothing to do with main. You can use auto registration tools
and have your own main.

> 2) I called init_unit_test_suite( argc, argv ). Even though it was called, I am still getting this.

You are not supposed to call this function manually.

> 3) I defined a cpp_main(). This never got called. I was hoping that the existence of this symbol would cause initialization to happen elsewhere.

Wow, you adventurous. I recommend reading docs first.

> My desired control flow is to have this test program in control and to use the BOOST logging tools. I am trying to slip in boost.test with a minimum of changes to this program. I have hooked its logging function to call boost logging facilities instead; just can't get past this problem.

1. Here is an example that defines main: This
example does not use automated tools, but it might as well.

2. You may not need main. You can do your initialization either in
global fixture in in test suite initialization function (like in example



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