A top node in the hierarchy (below "All Tests") is again a TestFixture, which maybe almost empty except for "inserting" the next levels:
class AutoTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE( AutoTest );
CPPUNIT_INSERT_SUITE(BuchseTest);
...
CPPUNIT_TEST_SUITE_END();
...
}
The inserted suite does not need the automatic registration in the cpp-file.
hope that helps,
Wolfgang
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I need to create deep tests hierarchy.
Is it possible to add one named registry into another one?
Thanks in advance.
I added a new macro to HelperMacros.h:
#define CPPUNIT_INSERT_SUITE( testSuite ) \
CppUnit::TestSuiteFactory<testSuite>* __CPPUNIT_CONCATENATE( suite, testSuite ) = \
new CppUnit::TestSuiteFactory<testSuite>(); \
builder.addTest(__CPPUNIT_CONCATENATE( suite, testSuite )->makeTest()); \
delete __CPPUNIT_CONCATENATE( suite, testSuite ); \
factory = factory; // suppress unused warning
A top node in the hierarchy (below "All Tests") is again a TestFixture, which maybe almost empty except for "inserting" the next levels:
class AutoTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE( AutoTest );
CPPUNIT_INSERT_SUITE(BuchseTest);
...
CPPUNIT_TEST_SUITE_END();
...
}
The inserted suite does not need the automatic registration in the cpp-file.
hope that helps,
Wolfgang
Yes.
Refer to cppunit 1.9.8 documentation, module/Creating TestSuite.
Look up:
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION
CPPUNIT_REGISTRY_ADD
CPPUNIT_REGISTRY_ADD_TO_DEFAULT
Baptiste.