fussel4711 - 2014-02-26

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:

CPPUNIT_PARAMETERIZED_TEST_SUITE(<TestSuiteClass>, <ParameterType>);
 * Put plain old tests here.

In the implementation file you need to replace the old CPPUNIT_TEST_SUITE_REGISTRATION macro with:


These macros require you to implement the methods:

static std::vector parameters();
void testWithParameter(ParameterType& parameter);
  • parameters(): Provides a vector with the parameters.
  • testWithParameter(...): Is called for each parameter. This is where you implement your parameterized test.

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 ;)