#include <TestFactoryRegistry.h>
Inheritance diagram for TestFactoryRegistry:
List of all members.
Notes that the registry DON'T assumes lifetime control for any registered tests anymore.
The default registry is the registry returned by getRegistry() with the default name parameter value.
To register tests, use the macros:
Example 1: retreiving a suite that contains all the test registered with CPPUNIT_TEST_SUITE_REGISTRATION().
CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry(); CppUnit::TestSuite *suite = registry.makeTest();
Example 2: retreiving a suite that contains all the test registered with CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ..., "Math" ).
CppUnit::TestFactoryRegistry &mathRegistry = CppUnit::TestFactoryRegistry::getRegistry( "Math" );
CppUnit::TestSuite *mathSuite = mathRegistry.makeTest();
Example 3: creating a test suite hierarchy composed of unnamed registration and named registration:
CppUnit::TestSuite *rootSuite = new CppUnit::TestSuite( "All tests" ); rootSuite->addTest( CppUnit::TestFactoryRegistry::getRegistry( "Graph" ).makeTest() ); rootSuite->addTest( CppUnit::TestFactoryRegistry::getRegistry( "Math" ).makeTest() ); CppUnit::TestFactoryRegistry::getRegistry().addTestToSuite( rootSuite );
The same result can be obtained with:
CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry(); registry.addRegistry( "Graph" ); registry.addRegistry( "Math" ); CppUnit::TestSuite *suite = registry.makeTest();
Since a TestFactoryRegistry is a TestFactory, the named registries can be registered in the unnamed registry, creating the hierarchy links.
CPPUNIT_TEST_SUITE_REGISTRATION, CPPUNIT_TEST_SUITE_NAMED_REGISTRATION
[private]
Constructs the registry with the specified name.
[virtual]
Destructor.
[private]
Adds a registry to the registry.
Convenience method to help create test hierarchy. See TestFactoryRegistry detail for examples of use. Calling this method is equivalent to:
this->registerFactory( TestFactoryRegistry::getRegistry( name ) );
Adds the registered tests to the specified suite.
"All Tests"
)
[static]
Returns a named registry.
If the name is left to its default value, then the registry that is returned is the one used by CPPUNIT_TEST_SUITE_REGISTRATION(): the 'top' level registry.
[static]
Tests if the registry is valid.
This method should be used when unregistering test factory on static variable destruction to ensure that the registry has not been already destroyed (in that case there is no need to unregister the test factory).
You should not concern yourself with this method unless you are writing a class like AutoRegisterSuite.
true
if the specified registry has not been destroyed, otherwise returns false
.
[virtual]
Returns a new TestSuite that contains the registered test.
Implements TestFactory.
[private]
Adds the specified TestFactory with a specific name (DEPRECATED).
Removes the specified TestFactory from the registry.
The specified factory is not destroyed.
[private]