CppUnit - The Unit Testing Library

CppUnit project page | FAQ

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 <deque>
13
14
15 CPPUNIT_NS_BEGIN
16
17
31 class CPPUNIT_API TestResultCollector : public TestSuccessListener
32{
33public:
34 typedef std::deque<TestFailure *> TestFailures;
35 typedef std::deque<Test *> Tests;
36
37
40 TestResultCollector( SynchronizationObject *syncObject = 0 );
41
43 virtual ~TestResultCollector();
44
45 void startTest( Test *test );
46 void addFailure( const TestFailure &failure );
47
48 virtual void reset();
49
50 virtual int runTests() const;
51 virtual int testErrors() const;
52 virtual int testFailures() const;
53 virtual int testFailuresTotal() const;
54
55 virtual const TestFailures& failures() const;
56 virtual const Tests &tests() const;
57
58protected:
59 void freeFailures();
60
61 Tests m_tests;
62 TestFailures m_failures;
63 int m_testErrors;
64
65private:
67 TestResultCollector( const TestResultCollector &copy );
68
70 void operator =( const TestResultCollector &copy );
71};
72
73
74
75 CPPUNIT_NS_END
76
77#if CPPUNIT_NEED_DLL_DECL
78#pragma warning( pop )
79#endif
80
81
82#endif // CPPUNIT_TESTRESULTCOLLECTOR_H
CPPUNIT_API
#define CPPUNIT_API
Definition CppUnitApi.h:27
Portability.h
CPPUNIT_NS_END
#define CPPUNIT_NS_END
Definition Portability.h:106
CPPUNIT_NS_BEGIN
#define CPPUNIT_NS_BEGIN
Definition Portability.h:105
TestSuccessListener.h
SynchronizedObject::SynchronizationObject
Abstract synchronization object (mutex)
Definition SynchronizedObject.h:28
SynchronizedObject::operator=
void operator=(const SynchronizedObject &copy)
Prevents the use of the copy operator.
TestFailure
Record of a failed Test execution.
Definition TestFailure.h:25
Test
Base class for all test objects.
Definition Test.h:26
TestListener::startTest
virtual void startTest(Test *)
Called when just before a TestCase is run.
Definition TestListener.h:100
TestResultCollector
Collects test result.
Definition TestResultCollector.h:32
TestResultCollector::m_testErrors
int m_testErrors
Definition TestResultCollector.h:63
TestResultCollector::m_tests
Tests m_tests
Definition TestResultCollector.h:61
TestResultCollector::Tests
std::deque< Test * > Tests
Definition TestResultCollector.h:35
TestResultCollector::TestResultCollector
TestResultCollector(const TestResultCollector &copy)
Prevents the use of the copy constructor.
TestResultCollector::TestFailures
std::deque< TestFailure * > TestFailures
Definition TestResultCollector.h:34
TestResultCollector::m_failures
TestFailures m_failures
Definition TestResultCollector.h:62
TestSuccessListener
TestListener that checks if any test case failed.
Definition TestSuccessListener.h:16
TestSuccessListener::addFailure
void addFailure(const TestFailure &failure)
Called when a failure occurs while running a test.
Definition TestSuccessListener.cpp:28
TestSuccessListener::reset
virtual void reset()
Definition TestSuccessListener.cpp:20

| Send comments to: CppUnit Developers