TestWrapperTemplate< UserTestClass > Class Template Reference

TestWrapperTemplate wraps a test class with setUp/tearDown hooks around each test case method invocation. More...

#include <TestBase.h>

List of all members.

Public Types

typedef void(UserTestClass::*) FunctionType ()

Public Member Functions

 TestWrapperTemplate (std::string nameInit, boost::shared_ptr< UserTestClass > &pUserTestCaseInit)
void runTest (FunctionType pFunction)

Private Attributes

std::string name
boost::shared_ptr< UserTestClass > pUserTestCase


Detailed Description

template<class UserTestClass>
class TestWrapperTemplate< UserTestClass >

TestWrapperTemplate wraps a test class with setUp/tearDown hooks around each test case method invocation.

Definition at line 189 of file TestBase.h.


Member Typedef Documentation

template<class UserTestClass>
typedef void(UserTestClass::*) TestWrapperTemplate< UserTestClass >::FunctionType()

Definition at line 192 of file TestBase.h.


Constructor & Destructor Documentation

template<class UserTestClass>
TestWrapperTemplate< UserTestClass >::TestWrapperTemplate ( std::string  nameInit,
boost::shared_ptr< UserTestClass > &  pUserTestCaseInit 
) [inline]

Definition at line 200 of file TestBase.h.

References TestWrapperTemplate< UserTestClass >::name.

00203         : pUserTestCase(pUserTestCaseInit)
00204     {
00205         name = nameInit;
00206     }


Member Function Documentation

template<class UserTestClass>
void TestWrapperTemplate< UserTestClass >::runTest ( FunctionType  pFunction  )  [inline]

Definition at line 208 of file TestBase.h.

References TestWrapperTemplate< UserTestClass >::name, TestWrapperTemplate< UserTestClass >::pUserTestCase, and TRACE_SEVERE.

00209     {
00210         pUserTestCase->beforeTestCase(name);
00211         pUserTestCase->testCaseSetUp();
00212         try {
00213             try {
00214                 ((*pUserTestCase).*pFunction)();
00215             } catch (std::exception &ex) {
00216                 pUserTestCase->notifyTrace(name, TRACE_SEVERE, ex.what());
00217                 throw ex;
00218             }
00219         } catch (...) {
00220             try {
00221                 pUserTestCase->testCaseTearDown();
00222             } catch (...) {
00223                 // ignore teardown errors after failure
00224             }
00225             throw;
00226         }
00227         try {
00228             pUserTestCase->testCaseTearDown();
00229         } catch (...) {
00230             pUserTestCase->afterTestCase(name);
00231             throw;
00232         }
00233         pUserTestCase->afterTestCase(name);
00234     }


Member Data Documentation

template<class UserTestClass>
std::string TestWrapperTemplate< UserTestClass >::name [private]

Definition at line 195 of file TestBase.h.

Referenced by TestWrapperTemplate< UserTestClass >::runTest(), and TestWrapperTemplate< UserTestClass >::TestWrapperTemplate().

template<class UserTestClass>
boost::shared_ptr<UserTestClass> TestWrapperTemplate< UserTestClass >::pUserTestCase [private]

Definition at line 196 of file TestBase.h.

Referenced by TestWrapperTemplate< UserTestClass >::runTest().


The documentation for this class was generated from the following file:
Generated on Mon Jun 22 04:00:48 2009 for Fennel by  doxygen 1.5.1