|
Boost : |
From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2005-12-26 19:37:58
first and foremost I would like to remond you the reason why fixtures
support did not appear before in Boost.Test: primary reason is that to
employ fixtures one doesn't need support from framework:
struct F {
F() {}
~F() {}
};
void test1()
{
F f;
}
void test1()
{
F f;
}
This way you could use any kind of fixtures: separate instance per test case
(as above), shared instance initialized in one and reused in another,
default contructed or initialized with arguments, simple structure or set of
two function or class template. Boost.Test chose to help in some most common
cases for auto registerred test cases. The model choosen for Fixture is
simple structire with constructor as "setup" function and destructor as
"teardown" function.
> 1. Is there a way to specify that two auto-unit tests must come in a
> certain order? What about any kind of tests? Or do you have to create a
> giant test to force a particular order?
By default test cases run in an order they are registeered. For auto
registerred test cases it's usually he natural order within a file. for
manually registerred test cases you could setup you preferred order. You
could also run test cases in random order.
> 2. If the answer to [1] is "yes," then can fixtures be used to carry over
> changed variables between tests?
Yes - if you use fixtures as in example above. No - if you want to employ
BOOST_FIXURE_TEST_CASE
> 3. Can a fixture be a class template, so it can be used with a auto-unit
> test template such that the fixture changes its class parameter to match
> the
> test's parameter? (I worked around this currently by using an inner class
> template within a non-template class fixture.)
Yes - if you use fixtures as in example above. No - if you want to employ
BOOST_FIXURE_TEST_CASE_TEMPLATE
Gennadiy
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk