CppUnit project page FAQ CppUnit home page

TestResult.h
Go to the documentation of this file.
1 #ifndef CPPUNIT_TESTRESULT_H
2 #define CPPUNIT_TESTRESULT_H
3 
4 #include <cppunit/Portability.h>
5 
6 #if CPPUNIT_NEED_DLL_DECL
7 #pragma warning( push )
8 #pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z
9 #endif
10 
13 
15 
16 
17 class Exception;
18 class Functor;
19 class Protector;
20 class ProtectorChain;
21 class Test;
22 class TestFailure;
23 class TestListener;
24 
25 
26 #if CPPUNIT_NEED_DLL_DECL
27 // template class CPPUNIT_API std::deque<TestListener *>;
28 #endif
29 
51 {
52 public:
54  TestResult( SynchronizationObject *syncObject = 0 );
55 
57  virtual ~TestResult();
58 
59  virtual void addListener( TestListener *listener );
60 
61  virtual void removeListener( TestListener *listener );
62 
64  virtual void reset();
65 
67  virtual void stop();
68 
70  virtual bool shouldStop() const;
71 
73  virtual void startTest( Test *test );
74 
79  virtual void addError( Test *test, Exception *e );
80 
84  virtual void addFailure( Test *test, Exception *e );
85 
87  virtual void endTest( Test *test );
88 
90  virtual void startSuite( Test *test );
91 
93  virtual void endSuite( Test *test );
94 
99  virtual void runTest( Test *test );
100 
116  virtual bool protect( const Functor &functor,
117  Test *test,
118  const std::string &shortDescription = std::string("") );
119 
121  virtual void pushProtector( Protector *protector );
122 
124  virtual void popProtector();
125 
126 protected:
129  void addFailure( const TestFailure &failure );
130 
131  virtual void startTestRun( Test *test );
132  virtual void endTestRun( Test *test );
133 
134 protected:
135  typedef CppUnitDeque<TestListener *> TestListeners;
138  bool m_stop;
139 
140 private:
141  TestResult( const TestResult &other );
142  TestResult &operator =( const TestResult &other );
143 };
144 
145 
147 
148 
149 #if CPPUNIT_NEED_DLL_DECL
150 #pragma warning( pop )
151 #endif
152 
153 #endif // CPPUNIT_TESTRESULT_H
154 
155 
Exceptions thrown by failed assertions.Exception is an exception that serves descriptive strings thro...
Definition: Exception.h:19
Protects one or more test case run.
Definition: Protector.h:47
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
TestListeners m_listeners
Definition: TestResult.h:136
ProtectorChain * m_protectorChain
Definition: TestResult.h:137
Base class for all test objects.All test objects should be a subclass of Test. Some test objects...
Definition: Test.h:25
Definition: Protector.h:14
bool m_stop
Definition: TestResult.h:138
Abstract synchronization object (mutex)
Definition: SynchronizedObject.h:27
Record of a failed Test execution.A TestFailure collects a failed test together with the caught excep...
Definition: TestFailure.h:24
Protector chain (Implementation). Implementation detail.
Definition: ProtectorChain.h:19
#define CPPUNIT_NS_END
Definition: Portability.h:120
#define CPPUNIT_NS_BEGIN
Definition: Portability.h:119
Listener for test progress and result.Implementing the Observer pattern a TestListener may be registe...
Definition: TestListener.h:94
CppUnitDeque< TestListener * > TestListeners
Definition: TestResult.h:135
void operator=(const SynchronizedObject &copy)
Prevents the use of the copy operator.
#define CPPUNIT_API
Definition: CppUnitApi.h:27
Base class for synchronized object.
Definition: SynchronizedObject.h:22

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