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
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#include <string>
14
16
17
18class Exception;
19class Functor;
20class Protector;
21class ProtectorChain;
22class Test;
23class TestFailure;
24class TestListener;
25
26
27#if CPPUNIT_NEED_DLL_DECL
28// template class CPPUNIT_API std::deque<TestListener *>;
29#endif
30
52{
53public:
55 TestResult( SynchronizationObject *syncObject = 0 );
56
58 virtual ~TestResult();
59
60 virtual void addListener( TestListener *listener );
61
62 virtual void removeListener( TestListener *listener );
63
65 virtual void reset();
66
68 virtual void stop();
69
71 virtual bool shouldStop() const;
72
74 virtual void startTest( Test *test );
75
80 virtual void addError( Test *test, Exception *e );
81
85 virtual void addFailure( Test *test, Exception *e );
86
88 virtual void endTest( Test *test );
89
91 virtual void startSuite( Test *test );
92
94 virtual void endSuite( Test *test );
95
100 virtual void runTest( Test *test );
101
117 virtual bool protect( const Functor &functor,
118 Test *test,
119 const std::string &shortDescription = std::string("") );
120
122 virtual void pushProtector( Protector *protector );
123
125 virtual void popProtector();
126
127protected:
130 void addFailure( const TestFailure &failure );
131
132 virtual void startTestRun( Test *test );
133 virtual void endTestRun( Test *test );
134
135protected:
139 bool m_stop;
140
141private:
142 TestResult( const TestResult &other );
144};
145
146
148
149
150#if CPPUNIT_NEED_DLL_DECL
151#pragma warning( pop )
152#endif
153
154#endif // CPPUNIT_TESTRESULT_H
155
156
#define CPPUNIT_API
Definition CppUnitApi.h:27
#define CppUnitDeque
Definition CppUnitDeque.h:20
#define CPPUNIT_NS_END
Definition Portability.h:120
#define CPPUNIT_NS_BEGIN
Definition Portability.h:119
Exceptions thrown by failed assertions.
Definition Exception.h:20
Definition Protector.h:15
Protector chain (Implementation). Implementation detail.
Definition ProtectorChain.h:20
Protects one or more test case run.
Definition Protector.h:48
Abstract synchronization object (mutex)
Definition SynchronizedObject.h:28
SynchronizedObject(SynchronizationObject *syncObject=0)
Definition SynchronizedObject.cpp:7
void operator=(const SynchronizedObject &copy)
Prevents the use of the copy operator.
Record of a failed Test execution.
Definition TestFailure.h:25
Base class for all test objects.
Definition Test.h:26
Listener for test progress and result.
Definition TestListener.h:95
virtual void pushProtector(Protector *protector)
Adds the specified protector to the protector chain.
Definition TestResult.cpp:183
virtual void endTest(Test *test)
Informs TestListener that a test was completed.
Definition TestResult.cpp:77
virtual void addFailure(Test *test, Exception *e)
Adds a failure to the list of failures. The passed in exception caused the failure.
Definition TestResult.cpp:47
virtual bool protect(const Functor &functor, Test *test, const std::string &shortDescription=std::string(""))
Protects a call to the specified functor.
Definition TestResult.cpp:173
virtual void popProtector()
Removes the last protector from the protector chain.
Definition TestResult.cpp:190
virtual void addListener(TestListener *listener)
Definition TestResult.cpp:126
virtual void startTestRun(Test *test)
Definition TestResult.cpp:151
virtual void stop()
Stop testing.
Definition TestResult.cpp:118
virtual void reset()
Resets the stop flag.
Definition TestResult.cpp:30
virtual void startSuite(Test *test)
Informs TestListener that a test suite will be started.
Definition TestResult.cpp:88
TestListeners m_listeners
Definition TestResult.h:137
virtual void removeListener(TestListener *listener)
Definition TestResult.cpp:134
CppUnitDeque< TestListener * > TestListeners
Definition TestResult.h:136
TestResult(SynchronizationObject *syncObject=0)
Construct a TestResult.
Definition TestResult.cpp:14
virtual void runTest(Test *test)
Run the specified test.
Definition TestResult.cpp:142
virtual void startTest(Test *test)
Informs TestListener that a test will be started.
Definition TestResult.cpp:66
virtual void addError(Test *test, Exception *e)
Adds an error to the list of errors. The passed in exception caused the error.
Definition TestResult.cpp:38
virtual bool shouldStop() const
Returns whether testing should be stopped.
Definition TestResult.cpp:110
virtual void endTestRun(Test *test)
Definition TestResult.cpp:162
virtual void endSuite(Test *test)
Informs TestListener that a test suite was completed.
Definition TestResult.cpp:99
TestResult(const TestResult &other)
bool m_stop
Definition TestResult.h:139
ProtectorChain * m_protectorChain
Definition TestResult.h:138

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