CppUnit project page | FAQ | CppUnit home page |
Classes | |
class | TestFactoryRegistry |
Registry for TestFactory.Notes that the registry DON'T assumes lifetime control for any registered tests anymore. More... | |
class | TestSuite |
A Composite of Tests.It runs a collection of test cases. Here is an example. More... | |
Defines | |
#define | CPPUNIT_TEST_SUITE_REGISTRATION(ATestFixtureType) |
#define | CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(ATestFixtureType, suiteName) |
Adds the specified fixture suite to the specified registry suite. | |
#define | CPPUNIT_REGISTRY_ADD(which, to) |
#define | CPPUNIT_REGISTRY_ADD_TO_DEFAULT(which) |
#define CPPUNIT_REGISTRY_ADD | ( | which, | |
to | |||
) |
static CPPUNIT_NS::AutoRegisterRegistry \ CPPUNIT_MAKE_UNIQUE_NAME( autoRegisterRegistry__ )( which, to )
Adds that the specified registry suite to another registry suite.
Use this macros to automatically create test registry suite hierarchy. For example, if you want to create the following hierarchy:
You can do this automatically with:
CPPUNIT_REGISTRY_ADD( "FastFloat", "FloatMath" ); CPPUNIT_REGISTRY_ADD( "IntegerMath", "Math" ); CPPUNIT_REGISTRY_ADD( "FloatMath", "Math" ); CPPUNIT_REGISTRY_ADD( "StandardFloat", "FloatMath" );
There is no specific order of declaration. Think of it as declaring links.
You register the test in each suite using CPPUNIT_TEST_SUITE_NAMED_REGISTRATION.
which | Name of the registry suite to add to the registry suite named to. |
to | Name of the registry suite which is added to. |
#define CPPUNIT_REGISTRY_ADD_TO_DEFAULT | ( | which | ) |
static CPPUNIT_NS::AutoRegisterRegistry \ CPPUNIT_MAKE_UNIQUE_NAME( autoRegisterRegistry__ )( which )
Adds that the specified registry suite to the default registry suite.
This macro is just like CPPUNIT_REGISTRY_ADD except the specified registry suite is added to the default suite (root suite).
which | Name of the registry suite to add to the default registry suite. |
#define CPPUNIT_TEST_SUITE_NAMED_REGISTRATION | ( | ATestFixtureType, | |
suiteName | |||
) |
static CPPUNIT_NS::AutoRegisterSuite< ATestFixtureType > \ CPPUNIT_MAKE_UNIQUE_NAME(autoRegisterRegistry__ )(suiteName)
Adds the specified fixture suite to the specified registry suite.
This macro declares a static variable whose construction causes a test suite factory to be inserted in the global registry suite of the specified name. The registry is available by calling the static function CppUnit::TestFactoryRegistry::getRegistry().
For the suite name, use a string returned by a static function rather than a hardcoded string. That way, you can know what are the name of named registry and you don't risk mistyping the registry name.
// MySuites.h namespace MySuites { std::string math() { return "Math"; } } // ComplexNumberTest.cpp #include "MySuites.h" CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ComplexNumberTest, MySuites::math() );
ATestFixtureType | Type of the test case class. |
suiteName | Name of the global registry suite the test suite is registered into. |
#define CPPUNIT_TEST_SUITE_REGISTRATION | ( | ATestFixtureType | ) |
static CPPUNIT_NS::AutoRegisterSuite< ATestFixtureType > \ CPPUNIT_MAKE_UNIQUE_NAME(autoRegisterRegistry__ )
Adds the specified fixture suite to the unnamed registry.
This macro declares a static variable whose construction causes a test suite factory to be inserted in a global registry of such factories. The registry is available by calling the static function CppUnit::TestFactoryRegistry::getRegistry().
ATestFixtureType | Type of the test case class. |
|
hosts this site. |
Send comments to: CppUnit Developers |