CppUnit project page CppUnit home page

lighttestrunner.h

Go to the documentation of this file.
00001 #ifndef CPPUT_LIGHTTESTRUNNER_H_INCLUDED
00002 # define CPPUT_LIGHTTESTRUNNER_H_INCLUDED
00003 
00004 # include <cpput/forwards.h>
00005 # include <cpput/testinfo.h>
00006 # include <cpptl/intrusiveptr.h>
00007 # include <deque>
00008 
00009 namespace CppUT {
00010 
00011    /* Lightweight test runner intended for unit testing CppUnit itself 
00012     * and the open test framework.
00013     */
00014    class LightTestRunner : private TestResultUpdater
00015    {
00016    public:
00017       LightTestRunner();
00018 
00019       virtual ~LightTestRunner();
00020 
00021       void addTest( const TestPtr &test );
00022 
00023       bool runAllTests();
00024 
00025    private: // overridden from TestResultUpdater
00026       virtual void addResultLog( const Json::Value &log );
00027 
00028       virtual void addResultAssertion( const Assertion &assertion );
00029 
00030    private:
00031       void runTest( const TestPtr &test );
00032       void runTestSuite( const TestSuitePtr &suite );
00033       void runTestCase( const AbstractTestCasePtr &testCase );
00034       CppTL::ConstString getTestPath() const;
00035       void reportFailure( const Assertion &failure );
00036       void reportLog( const Json::Value &log );
00037 
00038       struct ResultElement
00039       {
00040          int index_;
00041          bool isLog_;
00042       };
00043 
00044       typedef std::deque<TestPtr> Tests;
00045       Tests tests_;
00046       typedef std::deque<AbstractTestCasePtr> TestCases;
00047       TestCases testCases_;
00048       typedef std::deque<CppTL::ConstString> TestPath;
00049       TestPath testPath_;
00050       CppTL::StringBuffer report_;
00051       typedef std::deque<Json::Value> Logs;
00052       Logs logs_;
00053       typedef std::deque<Assertion> Assertions;
00054       Assertions assertions_;
00055       typedef std::deque<ResultElement> ResultElements;
00056       ResultElements results_;
00057       unsigned int testRun_;
00058       unsigned int testFailed_;
00059       unsigned int testSkipped_;
00060       unsigned int ignoredFailureCount_;
00061    }; 
00062 
00063 } // namespace CppUT
00064 
00065 
00066 #endif // CPPUT_LIGHTTESTRUNNER_H_INCLUDED

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