[Cppunit-devel] TestRegistryFactory and named suite registration...
Brought to you by:
blep
From: Baptiste L. <gai...@fr...> - 2001-06-13 13:54:21
|
This is a follow up to Michael Gerlek question in the forum: "Possible bugs in Registry extension files?" The TestFactoryRegistry allow you to register a suite with a given name, and the AutoRegisterSuite named constructor allow you to automatically to that. This work well. The problem come when you try to register a named suite created into the TestFactoryRegistry into another TestFactoryRegistry. For example, if you want to have the following suite hierarchy: All Tests Functionnal Model Message UnitTest You should be able to do: TestFactoryRegistry &allTests = TestFactoryRegistry::getRegistry() TestFactoryRegistry &functionnal = TestFactoryRegistry::getRegistry ( "Functionnal" ) allTests.registerFactory( functionnal ) This would add the "Functionnal" suite a child of "All Tests" functionnal.registerFactory( TestFactoryRegistry::getRegistry("Model" ) ); functionnal.registerFactory( TestFactoryRegistry::getRegistry("Message" ) ); This make the "Model" and "Message" suites children of the "Functionnal" suite. This nifty tricks allow you to retreive a full suite hierarchy with: allTests.makeTest() ;-) The problem is that the registry assumes ownership of registered test. As a result, suite registered this way would be destroyed twice. I still haven't though much about a way to solve the problem. Ideas are welcome. Once this problem is solved, we can go ahead and add a CPPUNIT_TEST_SUITE_NAMED_REGISTRATION as suggested by Michael. Baptiste. --- Baptiste Lepilleur <gai...@fr...> http://gaiacrtn.free.fr/index.html Language: English, French |