1 #ifndef CPPUNIT_TESTRESULTCOLLECTOR_H
2 #define CPPUNIT_TESTRESULTCOLLECTOR_H
4 #include <cppunit/Portability.h>
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
11 #include <cppunit/TestSuccessListener.h>
12 #include <cppunit/portability/CppUnitDeque.h>
17 #if CPPUNIT_NEED_DLL_DECL
18 // template class CPPUNIT_API std::deque<TestFailure *>;
19 // template class CPPUNIT_API std::deque<Test *>;
23 /*! \brief Collects test result.
24 * \ingroup WritingTestResult
25 * \ingroup BrowsingCollectedTestResult
27 * A TestResultCollector is a TestListener which collects the results of executing
28 * a test case. It is an instance of the Collecting Parameter pattern.
30 * The test framework distinguishes between failures and errors.
31 * A failure is anticipated and checked for with assertions. Errors are
32 * unanticipated problems signified by exceptions that are not generated
34 * \see TestListener, TestFailure.
36 class CPPUNIT_API TestResultCollector : public TestSuccessListener
39 typedef CppUnitDeque<TestFailure *> TestFailures;
40 typedef CppUnitDeque<Test *> Tests;
43 /*! Constructs a TestResultCollector object.
45 TestResultCollector( SynchronizationObject *syncObject = 0 );
48 virtual ~TestResultCollector();
50 void startTest( Test *test );
51 void addFailure( const TestFailure &failure );
55 virtual int runTests() const;
56 virtual int testErrors() const;
57 virtual int testFailures() const;
58 virtual int testFailuresTotal() const;
60 virtual const TestFailures& failures() const;
61 virtual const Tests &tests() const;
67 TestFailures m_failures;
71 /// Prevents the use of the copy constructor.
72 TestResultCollector( const TestResultCollector © );
74 /// Prevents the use of the copy operator.
75 void operator =( const TestResultCollector © );
82 #if CPPUNIT_NEED_DLL_DECL
83 #pragma warning( pop )
87 #endif // CPPUNIT_TESTRESULTCOLLECTOR_H