[Cppunit-cvs] cppunit2/src/cpput testrunner.cpp,1.7,1.8
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2004-11-21 22:26:06
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27026/src/cpput Modified Files: testrunner.cpp Log Message: * test result are propagated to the test runner during test Index: testrunner.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testrunner.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** testrunner.cpp 20 Nov 2004 16:17:33 -0000 1.7 --- testrunner.cpp 21 Nov 2004 22:24:46 -0000 1.8 *************** *** 49,57 **** ! /* ! class TestRunner::TestTrackerListener : public TestListener { public: ! TestTrackerListener( OpenTest::TestRunTracker &tracker ) : tracker_( tracker ) , testEntry_( 0 ) --- 49,56 ---- ! class TestRunner::TestResultUpdaterImpl : public TestResultUpdater { public: ! TestResultUpdaterImpl( OpenTest::TestRunTracker &tracker ) : tracker_( tracker ) , testEntry_( 0 ) *************** *** 64,92 **** } ! public: // overridden from TestListener ! void processTestResult( TestResult &result, ! TestContext &context ) { ! if ( !testEntry_ ) ! return; ! ! // Notes: at the current time, we don't retrieve the message ! // in a structured way. => need to change message to use ! // OpenTest::Properties. ! OpenTest::Properties openResult; ! openResult["result"]["status"]["success"] = result.succeeded(); ! openResult["result"]["status"]["type"] = result.resultType(); ! openResult["result"]["status"]["message"] = result.message().toString(); ! if ( result.location().isValid() ) ! { ! OpenTest::Value &openLocation = openResult["result"]["status"]["location"]; ! openLocation["file"] = result.location().fileName(); ! openLocation["line"] = result.location().lineNumber(); ! if ( result.location().hasFunctionName() ) ! openLocation["function"] = result.location().functionName(); ! } ! tracker_.mergeInTestResult( *testEntry_, openResult ); } --- 63,82 ---- } ! // overridden from TestResultUpdater ! void mergeInResult( const OpenTest::Properties &result ) { ! tracker_.mergeInTestResult( *testEntry_, result ); ! } ! void mergeInResult( const OpenTest::PropertyPath &path, ! const OpenTest::Value &value ) ! { ! tracker_.mergeInTestResult( *testEntry_, path, value ); ! } ! void appendToResult( const OpenTest::PropertyPath &path, ! const OpenTest::Value &value ) ! { ! tracker_.appendToTestResult( *testEntry_, path, value ); } *************** *** 95,99 **** const OpenTest::TestPlanEntry *testEntry_; }; - */ --- 85,88 ---- *************** *** 136,139 **** --- 125,131 ---- { tracker.startTestRun(); + TestResultUpdaterImplPtr resultUpdater( new TestResultUpdaterImpl( tracker ) ); + TestInfo::setTestResultUpdater( CppTL::staticPointerCast<TestResultUpdater>( + resultUpdater ) ); OpenTest::TestPlanEntryPtrEnum enumEntries = testPlan.entries(); *************** *** 141,144 **** --- 133,137 ---- { const OpenTest::TestPlanEntry &entry = *enumEntries.next(); + resultUpdater->setTestPlanEntry( entry ); OpenTest::TestId id = entry.test(); DeclaredTests::const_iterator itTest = tests_.find( id ); |