It would be nice if each test of a fixture can be
parameterize (with an xml formatting string for example).
That way, for a same fixture plugin, we can run it
several times with different parameters.
I've implemented some macros aiding to define parameterized CppUnit tests.
With this solution you just need to replace the old macros CPPUNIT_TEST_SUITE and CPPUNIT_TEST_SUITE_END within the class's header file:
* Put plain old tests here.
In the implementation file you need to replace the old CPPUNIT_TEST_SUITE_REGISTRATION macro with:
CPPUNIT_PARAMETERIZED_TEST_SUITE_REGISTRATION (<TestSuiteClass>, <ParameterType>)
These macros require you to implement the methods:
static std::vector parameters();
void testWithParameter(ParameterType& parameter);
A detailed explanation can be found here: http://brain-child.de/engineering/parameterizing-cppunit-tests
The german version can be found here: http://brain-child.de/engineering/parametrierbare-tests-cppunit
I would appreciate if the CppUnit team will integrate my work into the CppUnit framework. In this case it would be nice if you mention the source within the source code and documentation ;)
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.