CppUnit project page FAQ CppUnit home page

TestPlugIn.h
Go to the documentation of this file.
1 #ifndef CPPUNIT_PLUGIN_TESTPLUGIN
2 #define CPPUNIT_PLUGIN_TESTPLUGIN
3 
4 #include <cppunit/Portability.h>
5 
6 #if !defined(CPPUNIT_NO_TESTPLUGIN)
7 
9 
11 
12 
13 class Test;
15 class TestResult;
16 class XmlOutputter;
17 
19 
44 {
58  virtual void initialize( CPPUNIT_NS::TestFactoryRegistry *registry,
59  const CPPUNIT_NS::PlugInParameters &parameters ) =0;
60 
68  virtual void addListener( CPPUNIT_NS::TestResult *eventManager ) =0;
69 
74  virtual void removeListener( CPPUNIT_NS::TestResult *eventManager ) =0;
75 
78  virtual void addXmlOutputterHooks( CPPUNIT_NS::XmlOutputter *outputter ) =0;
79 
84  virtual void removeXmlOutputterHooks() = 0;
85 
94  virtual void uninitialize( CPPUNIT_NS::TestFactoryRegistry *registry ) =0;
95 };
96 
97 
98 
107 #define CPPUNIT_PLUGIN_EXPORTED_NAME cppunitTestPlugIn
108 
112 typedef CppUnitTestPlugIn *(*TestPlugInSignature)();
113 
114 
118 #define CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL( TestPlugInInterfaceType ) \
119  CPPUNIT_PLUGIN_EXPORT CppUnitTestPlugIn *CPPUNIT_PLUGIN_EXPORTED_NAME(void) \
120  { \
121  static TestPlugInInterfaceType plugIn; \
122  return &plugIn; \
123  } \
124  typedef char __CppUnitPlugInExportFunctionDummyTypeDef // dummy typedef so it can end with ';'
125 
126 
127 // Note: This include should remain after definition of CppUnitTestPlugIn
129 
130 
139 // Win32
140 #if defined(CPPUNIT_HAVE_WIN32_DLL_LOADER)
141 #if !defined(APIENTRY)
142 #define WIN32_LEAN_AND_MEAN
143 #define NOGDI
144 #define NOUSER
145 #define NOKERNEL
146 #define NOSOUND
147 #define NOMINMAX
148 #define BLENDFUNCTION void // for mingw & gcc
149 #include <windows.h>
150 #endif
151 #define CPPUNIT_PLUGIN_IMPLEMENT_MAIN() \
152  BOOL APIENTRY DllMain( HANDLE hModule, \
153  DWORD ul_reason_for_call, \
154  LPVOID lpReserved ) \
155  { \
156  return TRUE; \
157  } \
158  typedef char __CppUnitPlugInImplementMainDummyTypeDef
159 
160 // Unix
161 #elif defined(CPPUNIT_HAVE_UNIX_DLL_LOADER) || defined(CPPUNIT_HAVE_UNIX_SHL_LOADER)
162 #define CPPUNIT_PLUGIN_IMPLEMENT_MAIN() \
163  int main( int argc, char *argv[] ) \
164  { \
165  return 0; \
166  } \
167  typedef char __CppUnitPlugInImplementMainDummyTypeDef
168 
169 
170 // Other
171 #else // other platforms don't require anything specifics
172 #endif
173 
174 
175 
190 #define CPPUNIT_PLUGIN_IMPLEMENT() \
191  CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL( CPPUNIT_NS::TestPlugInDefaultImpl ); \
192  CPPUNIT_PLUGIN_IMPLEMENT_MAIN()
193 
194 
195 #endif // !defined(CPPUNIT_NO_TESTPLUGIN)
196 
197 
198 #endif // CPPUNIT_PLUGIN_TESTPLUGIN
virtual void uninitialize(CPPUNIT_NS::TestFactoryRegistry *registry)=0
Called just before unloading the dynamic library.
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.
Definition: TestPlugIn.h:43
Manages TestListener.A single instance of this class is used when running the test. It is usually created by the test runner (TestRunner).
Definition: TestResult.h:50
Outputs a TestResultCollector in XML format.Save the test result as a XML stream. ...
Definition: XmlOutputter.h:39
Base class for all test objects.All test objects should be a subclass of Test. Some test objects...
Definition: Test.h:25
virtual void removeListener(CPPUNIT_NS::TestResult *eventManager)=0
Gives a chance to the plug-in to remove its registered TestListener.
virtual void removeXmlOutputterHooks()=0
Called when the XmlOutputter is destroyed.
#define CPPUNIT_NS_END
Definition: Portability.h:120
#define CPPUNIT_NS_BEGIN
Definition: Portability.h:119
Registry for TestFactory.Notes that the registry DON&#39;T assumes lifetime control for any registered te...
Definition: TestFactoryRegistry.h:80
virtual void addXmlOutputterHooks(CPPUNIT_NS::XmlOutputter *outputter)=0
Provides a way for the plug-in to register some XmlOutputterHook.
virtual void initialize(CPPUNIT_NS::TestFactoryRegistry *registry, const CPPUNIT_NS::PlugInParameters &parameters)=0
Called just after loading the dynamic library.
virtual void addListener(CPPUNIT_NS::TestResult *eventManager)=0
Gives a chance to the plug-in to register TestListener.

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