CppUnit project page | FAQ

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
CppUnitTestPlugIn Struct Referenceabstract
Writing Test Plug-in

Test plug-in interface.This class define the interface implemented by test plug-in. A pointer to that interface is returned by the function exported by the test plug-in. More...

`#include <TestPlugIn.h>`

Inheritance diagram for CppUnitTestPlugIn:

## Public Member Functions

virtual void | initialize (CPPUNIT_NS::TestFactoryRegistry *registry, const CPPUNIT_NS::PlugInParameters &parameters)=0
| Called just after loading the dynamic library. More...
virtual void | addListener (CPPUNIT_NS::TestResult *eventManager)=0
| Gives a chance to the plug-in to register TestListener. More...
virtual void | removeListener (CPPUNIT_NS::TestResult *eventManager)=0
| Gives a chance to the plug-in to remove its registered TestListener. More...
virtual void | addXmlOutputterHooks (CPPUNIT_NS::XmlOutputter *outputter)=0
| Provides a way for the plug-in to register some XmlOutputterHook. More...
virtual void | removeXmlOutputterHooks ()=0
| Called when the XmlOutputter is destroyed. More...
virtual void | uninitialize (CPPUNIT_NS::TestFactoryRegistry *registry)=0
| Called just before unloading the dynamic library. More...
virtual | ~CppUnitTestPlugIn ()

## Detailed Description

Test plug-in interface.

This class define the interface implemented by test plug-in. A pointer to that interface is returned by the function exported by the test plug-in.

Plug-in are loaded/unloaded by PlugInManager. When a plug-in is loaded, initialize() is called. Before unloading the plug-in, the PlugInManager call uninitialize().

addListener() and removeListener() are called respectively before and after the test run.

addXmlOutputterHooks() and removeXmlOutputterHooks() are called respectively before and after writing the XML output using a XmlOutputter.

See also
  CPPUNIT_PLUGIN_IMPLEMENT, CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL
  CppUnit::TestPlugInDefaultImpl, CppUnit::XmlOutputter.

## Constructor & Destructor Documentation

virtual CppUnitTestPlugIn::~CppUnitTestPlugIn | ( |  | ) |

inline virtual

## Member Function Documentation

virtual void CppUnitTestPlugIn::addListener | ( | CPPUNIT_NS::TestResult * | eventManager | ) |

pure virtual

Gives a chance to the plug-in to register TestListener.

Override this method to add a TestListener for the test run. This is useful if you are writing a custom TestListener, but also if you need to setUp some global resource: listen to TestListener::startTestRun(), and TestListener::endTestRun().

virtual void CppUnitTestPlugIn::addXmlOutputterHooks | ( | CPPUNIT_NS::XmlOutputter * | outputter | ) |

pure virtual

Provides a way for the plug-in to register some XmlOutputterHook.

virtual void CppUnitTestPlugIn::initialize | ( | CPPUNIT_NS::TestFactoryRegistry * | registry,
|  | const CPPUNIT_NS::PlugInParameters & | parameters
| ) |  |

pure virtual

Called just after loading the dynamic library.

Override this method to add additional suite to the registry, though this is preferably done using the macros (CPPUNIT_TEST_SUITE_REGISTRATION...). If you are creating a custom listener to extends the plug-in runner, you can use this to configure the listener using the parameters.

You could also use the parameters to specify some global parameter, such as test datas location, database name...

N.B.: Parameters interface is not define yet, and the plug-in runner does not yet support plug-in parameter.

virtual void CppUnitTestPlugIn::removeListener | ( | CPPUNIT_NS::TestResult * | eventManager | ) |

pure virtual

Gives a chance to the plug-in to remove its registered TestListener.

Override this method to remove a TestListener that has been added.

virtual void CppUnitTestPlugIn::removeXmlOutputterHooks | ( |  | ) |

pure virtual

Called when the XmlOutputter is destroyed.

Can be used to free some resources allocated by addXmlOutputterHooks().

Implemented in TestPlugInDefaultImpl.

virtual void CppUnitTestPlugIn::uninitialize | ( | CPPUNIT_NS::TestFactoryRegistry * | registry | ) |

pure virtual

Called just before unloading the dynamic library.

Override this method to unregister test factory added in initialize(). This is necessary to keep the TestFactoryRegistry 'clean'. When the plug-in is unloaded from memory, the TestFactoryRegistry will hold reference on test that are no longer available if they are not unregistered.

The documentation for this struct was generated from the following file:

- TestPlugIn.h

| Send comments to: CppUnit Developers