CppUnit project page | FAQ

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

- File List
- File Members

TestResultCollector.h
Go to the documentation of this file.
1 #ifndef CPPUNIT_TESTRESULTCOLLECTOR_H
2 #define CPPUNIT_TESTRESULTCOLLECTOR_H
3
4 #include <cppunit/Portability.h>
5
6 #if CPPUNIT_NEED_DLL_DECL
7 #pragma warning( push )
8 #pragma warning( disable: 4251 4660 ) // X needs to have dll-interface to be used by clients of class Z
9 #endif
10
11 #include <cppunit/TestSuccessListener.h>
12 #include <cppunit/portability/CppUnitDeque.h>
13
14
15 CPPUNIT_NS_BEGIN
16
17 #if CPPUNIT_NEED_DLL_DECL
18 // template class CPPUNIT_API std::deque<TestFailure *>;
19 // template class CPPUNIT_API std::deque<Test *>;
20 #endif
21
22
36 class CPPUNIT_API TestResultCollector : public TestSuccessListener
37 {
38 public:
39 typedef CppUnitDeque<TestFailure *> TestFailures;
40 typedef CppUnitDeque<Test *> Tests;
41
42
45 TestResultCollector( SynchronizationObject *syncObject = 0 );
46
48 virtual ~TestResultCollector();
49
50 void startTest( Test *test );
51 void addFailure( const TestFailure &failure );
52
53 virtual void reset();
54
55 virtual int runTests() const;
56 virtual int testErrors() const;
57 virtual int testFailures() const;
58 virtual int testFailuresTotal() const;
59
60 virtual const TestFailures& failures() const;
61 virtual const Tests &tests() const;
62
63 protected:
64 void freeFailures();
65
66 Tests m_tests;
67 TestFailures m_failures;
68 int m_testErrors;
69
70 private:
72 TestResultCollector( const TestResultCollector &copy );
73
75 void operator =( const TestResultCollector &copy );
76 };
77
78
79
80 CPPUNIT_NS_END
81
82 #if CPPUNIT_NEED_DLL_DECL
83 #pragma warning( pop )
84 #endif
85
86
87 #endif // CPPUNIT_TESTRESULTCOLLECTOR_H
TestSuccessListener::addFailure
void addFailure(const TestFailure &failure)
Called when a failure occurs while running a test.
Definition: TestSuccessListener.cpp:28
TestResultCollector::Tests
CppUnitDeque< Test * > Tests
Definition: TestResultCollector.h:40
Portability.h
TestResultCollector::TestFailures
CppUnitDeque< TestFailure * > TestFailures
Definition: TestResultCollector.h:39
TestSuccessListener.h
Test
Base class for all test objects.All test objects should be a subclass of Test. Some test objects...
Definition: Test.h:25
TestResultCollector::m_testErrors
int m_testErrors
Definition: TestResultCollector.h:68
TestResultCollector::m_tests
Tests m_tests
Definition: TestResultCollector.h:66
SynchronizedObject::SynchronizationObject
Abstract synchronization object (mutex)
Definition: SynchronizedObject.h:27
TestFailure
Record of a failed Test execution.A TestFailure collects a failed test together with the caught excep...
Definition: TestFailure.h:24
TestSuccessListener::reset
virtual void reset()
Definition: TestSuccessListener.cpp:20
CPPUNIT_NS_END
#define CPPUNIT_NS_END
Definition: Portability.h:120
TestResultCollector
Collects test result.A TestResultCollector is a TestListener which collects the results of executing ...
Definition: TestResultCollector.h:36
CPPUNIT_NS_BEGIN
#define CPPUNIT_NS_BEGIN
Definition: Portability.h:119
TestSuccessListener
TestListener that checks if any test case failed.
Definition: TestSuccessListener.h:14
TestResultCollector::m_failures
TestFailures m_failures
Definition: TestResultCollector.h:67
TestListener::startTest
virtual void startTest(Test *)
Called when just before a TestCase is run.
Definition: TestListener.h:100
SynchronizedObject::operator=
void operator=(const SynchronizedObject &copy)
Prevents the use of the copy operator.
CppUnitDeque.h
CPPUNIT_API
#define CPPUNIT_API
Definition: CppUnitApi.h:27

| Send comments to: CppUnit Developers