Boost logo

Boost :

From: Johan Nilsson (r.johan.nilsson_at_[hidden])
Date: 2006-01-31 03:11:28


Gennadiy Rozental wrote:
>>>> 3) BOOST_AUTO_TEST_MAIN no longer names master test suite
>>>
>>> "Feature not a bug" ;) Read update note how you should do this
>>
>> And the update note is where? Sorry, but I couldn't find it.
>
> http://lists.boost.org/Archives/boost/2005/12/98087.php
>

Aha, on the list ... I was looking in the documentation and the source. Yes,
I've already read that but didn't understand that naming through the macro
was unsupported.

>> Please don't tell me that I no longer can specify the name of the
>> master test suite.
>
> No. You could. But I found relying on macro is both inconvinient and
> unhealthy.

On the contrary, I found it most convenient (even though the macro name is a
bit misleading). Compare:

--- w/ macro ---

#define BOOST_AUTO_TEST_MAIN "foo"
#include <boost/test/auto_unit_test.hpp>

--- w/o macro ---

#include <boost/test/auto_unit_test.hpp>
boost::unit_test::test_suite*
init_unit_test_suite( int, char*[] )
{
    boost::unit_test::framework::master_test_suite().p_name.value = "foo";
    return 0;
}

---
As a side note, why does the above work? I'm not returning a pointer to a 
test suite.
>
>>>> 4) BOOST_AUTO_TEST_SUITE names not reported in errors
>>>
>>> "Feature not a bug" ;) With confirmation report only master test
>>> suite level name gets mentioned
>>
>> So, I'd like to make a new feature request - having the name of the
>> closest encompassing test suite being reported instead (as the
>> default). Or, even better, having the entire hierarchy reported.
>
> Test suite names gets reported in detailed report format. How would
> you prefer confirmation reporty should look like?
Using the above example, and adding the following to another file:
---
#include <boost/test/auto_unit_test.hpp>
BOOST_AUTO_TEST_SUITE(bar);
BOOST_AUTO_TEST_CASE(baz)
{
 BOOST_FAIL("Flunk!!");
}
BOOST_AUTO_TEST_SUITE_END();
---
This is what I currently get:
---
Running 1 test cases...
<some path>/bar.cpp(7): fatal error in "baz": Flunk!!
*** 1 failure detected in test suite "foo"
---
I can see that there would be a problem adding the specific test suite name 
to the summary line ("*** ..."), as it assumes only one test suite. How 
about adding the name to the actual error output:
<some path>/bar.cpp(7): fatal error in "foo::bar::baz": Flunk!!
I also kind of miss the regular CppUnit output; perhaps the "dotting" output 
during test runs, the error reports, the summary with X tests, Y assertions, 
Z failures.
What would the simplest steps be to provide something similar using 
Boost.Test? Perhaps some section in the docs for xUnit users - nailing down 
how to get the same output / summary using Boost.Test. Never mind if it is 
better or not - that's largely a matter of taste.
// Johan

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk