According to this piece of code, it looks like you should be able to retrieve the property at some point while you are creating your test suite to pass it as a parameter to a specific test.
Maybe the goal was to allow you to do:
#define CPPUNIT_TEST_WITH_PARAM(testMethod,param) \
CPPUNIT_TEST_ADD( new CppUnit::ParameterizedTestCase<ThisTestFixtureType>( \
context.getTestNameFor( #testMethod ), \
#testMethod, \
&TestFixtureType::testMethod, \
context.makeFixture(), \
context.getStringProperty( param ) ) )
CPPUNIT_TEST_SUITE( MyTestSuite);
CPPUNIT_TEST_SUITE_PROPERTY( "param1", "foo" )
CPPUNIT_TEST_SUITE_PROPERTY( "param2", "bar" )
CPPUNIT_CPPUNIT_TEST_WITH_PARAM( func, "param1" )
CPPUNIT_CPPUNIT_TEST_WITH_PARAM( func, "param2" )
CPPUNIT_TEST_SUITE_END();
void func( const std::string& param );
And this would have ended calling func("foo")
and func("bar")
. Which would be nice because it would have made it possible to add string parametrized tests.
However, and this is just a guess attempt, as ParameterizedTestCase
is not part of 1.12.1 old release, nor is it part of more recent releases (so does CPPUNIT_TEST_ADD
macro), I believe this is apparently something that was in a release plan but aborted and the macro CPPUNIT_TEST_SUITE_PROPERTY
remains useless here. The getStringProperty
also remains, and I found no way it could be used properly.
To conclude, this looks like a broken stuff and was anyway apparently not meant to share setup/teardown code, but more to have parametrized tests (which can be done by templates actually, see this post).