My organization is using CppUnit and I am trying to run the same test using different parameters. Running a loop inside the test is not a good option as any failure will abo
Upon of the suggestion of Marcin 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(, );
/*
* put plain old tests here.
*/
CPPUNIT_PARAMETERIZED_TEST_SUITE_END();
In the implementation file you need to replace the old CPPUNIT_TEST_SUITE_REGISTRATION macro with:
CPPUNIT_PARAMETERIZED_TEST_SUITE_REGISTRATION ( , )
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