CppUnit project page FAQ CppUnit home page

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Creating TestSuite


Compounds

class  CppUnit::TestFactoryRegistry
 Registry for TestFactory. More...

class  CppUnit::TestSuite
 A Composite of Tests. More...


Defines

#define CPPUNIT_TEST_SUITE_REGISTRATION(ATestFixtureType)
 Adds the specified fixture suite to the unnamed registry. More...

#define CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(ATestFixtureType, suiteName)
 Adds the specified fixture suite to the specified registry suite. More...


Define Documentation

#define CPPUNIT_TEST_SUITE_NAMED_REGISTRATION ATestFixtureType,
suiteName   
 

Value:

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() );
Parameters:
ATestFixtureType  Type of the test case class.
suiteName  Name of the global registry suite the test suite is registered into.
Warning:
This macro should be used only once per line of code (the line number is used to name a hidden static variable).
See also:
CPPUNIT_TEST_SUITE_REGISTRATION , CPPUNIT_TEST_SUITE, CppUnit::AutoRegisterSuite, CppUnit::TestFactoryRegistry..

#define CPPUNIT_TEST_SUITE_REGISTRATION ATestFixtureType   
 

Value:

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().

Parameters:
ATestFixtureType  Type of the test case class.
Warning:
This macro should be used only once per line of code (the line number is used to name a hidden static variable).
See also:
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION , CPPUNIT_TEST_SUITE, CppUnit::AutoRegisterSuite, CppUnit::TestFactoryRegistry.


SourceForge Logo hosts this site. Send comments to:
CppUnit Developers