Boost logo

Boost :

From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2008-07-24 00:59:42


On Thu, Jul 24, 2008 at 3:45 AM, Gennadiy Rozental <rogeeff_at_[hidden]> wrote:
> Dean Michael Berris <mikhailberis <at> gmail.com> writes:
>
>>
>> Okay, but it's not clear from this example whether using just the
>> normal BOOST_AUTO_TEST_CASE ( test_name ) would work with the correct
>> fixture type set using BOOST_FIXTURE_TEST_SUITE.
>
> Yes. It will. Give it a try.
>

Sounds encouraging. :-) I will. Thanks.

>> Even in the example,
>> BOOST_FIXTURE_TEST_SUITE (s,F) doesn't really convey much information
>
> New docs have much better examples
>

Can hardly wait to read those.

>> except maybe (I'm guessing) create a fixture test suite 's' of type F.
>> It isn't directly obvious how doing BOOST_FIXTURE_TEST_SUITE (...)
>> will actually influence all BOOST_AUTO_TEST_CASE(s) (or in the example
>> BOOST_AUTO_TEST_CASE_TEMPLATE) in the file.
>
> You don't need to know how. It just works ;) But if you are interested you can
> always look in the headers where it's implemented
>

Right. I looked into it but I was a little hazy with the details. I'll
look deeper if I need to find out more. :D

>> Perhaps using a convention like "do `#define BOOST_AUTO_TEST_FIXTURE
>> fixture_type_name` before including 'boost/test/unit_test.hpp'" would
>> work too and be more convenient -- especially in cases where you have
>> a family of related tests in one file. That way you just did:
>>
>> #ifndef BOOST_AUTO_TEST_FIXTURE
>> #define ...
>> #endif
>
>
> I do not see why we need this and how is it better than the solution currently
> implemented in the library
>

It isn't better, it's an alternative that is convenient compared to
setting up a test suite.

>> in the library to use what the user intended. That way it was less
>> intrusive than having to create a test suite when all you really have
>> are a collection of test cases in a test file.
>
> I do not see why creating test suite is intrusive
>

It's intrusive in terms of style -- having to think about the test
suite when all you need is test cases with fixtures at the simplest
way. But of course there's always different strokes for different
folks.

>> Of course I may be missing some things, but now that I know about
>> BOOST_FIXTURE_TEST_SUITE, I'll use that in the meantime. :D
>
> Give it a try and let me know if you have any problems
>

I will. Thanks.

>> >> I notice that there's a global level fixtures, but I'm more interested
>> >> in something that get constructed/destroyed with every test case
>> >> invocation -- much like the setUp() and tearDown() overloads in the
>> >> xUnit family of frameworks.
>> >
>> > The fixtures *are* constructed/destroyed per test case.
>>
>> Even the global fixture? I was under the impression that the global
>
> No. Global fixtures are constructed/destructor pre post whole testing process.
>

Right, thanks for making that clear.

Thanks again, and hope to see that documentation soon!

-- 
Dean Michael C. Berris
Software Engineer, Friendster, Inc.

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