summaryrefslogtreecommitdiff
path: root/src/cppunit/TextTestRunner.cpp
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2002-07-10 17:50:02 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2002-07-10 17:50:02 +0000
commit85aa074c02154107459755b2a3ddbc0b5767558a (patch)
treef48da462642cd10a74cc836a241b4b8fede53319 /src/cppunit/TextTestRunner.cpp
parentad45759ab7a47c7a7932f7e6be66f3ea106b643b (diff)
downloadcppunit-85aa074c02154107459755b2a3ddbc0b5767558a.tar.gz
Include/cppunit/extensions/AutoRegisterSuite.
include/cppunit/extensions/AutoRegisterSuite.h: * include/cppunit/extensions/Orthodox.h: * include/cppunit/extensions/TestSuiteBuilder.h: * include/cppunit/extensions/TestSuiteFactory.h: * include/cppunit/TestCaller.h: * examples/hierarchy/BoardGameTest.h: * examples/hierarchy/ChessTest.h: replaced usage of 'typename' in template declaration with 'class'. * include/cppunit/ui/text/TestRunner.h: * src/cppunit/TextTestRunner.cpp: updated to use the generic TestRunner. Removed methods runTestByName() and runTest(). Inherits CppUnit::TestRunner. * include/cppunit/extensions/TestSuiteBuilder.h: removed templatized method addTestCallerForException(). It is no longer used since release 1.9.8. * examples/cppunittest/MockTestCase.h * examples/cppunittest/MockTestCase.cpp: removed the usage of 'mutable' keyword.
Diffstat (limited to 'src/cppunit/TextTestRunner.cpp')
-rw-r--r--src/cppunit/TextTestRunner.cpp61
1 files changed, 11 insertions, 50 deletions
diff --git a/src/cppunit/TextTestRunner.cpp b/src/cppunit/TextTestRunner.cpp
index 74c1d8f..33c1908 100644
--- a/src/cppunit/TextTestRunner.cpp
+++ b/src/cppunit/TextTestRunner.cpp
@@ -18,7 +18,6 @@ namespace TextUi {
*/
TestRunner::TestRunner( Outputter *outputter )
: m_outputter( outputter )
- , m_suite( new TestSuite( "All Tests" ) )
, m_result( new TestResultCollector() )
, m_eventManager( new TestResult() )
{
@@ -33,19 +32,6 @@ TestRunner::~TestRunner()
delete m_eventManager;
delete m_outputter;
delete m_result;
- delete m_suite;
-}
-
-
-/*! Adds the specified test.
- *
- * \param test Test to add.
- */
-void
-TestRunner::addTest( Test *test )
-{
- if ( test != NULL )
- m_suite->addTest( test );
}
@@ -69,29 +55,20 @@ TestRunner::run( std::string testName,
bool doPrintResult,
bool doPrintProgress )
{
- runTestByName( testName, doPrintProgress );
- printResult( doPrintResult );
- wait( doWait );
- return m_result->wasSuccessful();
-}
+ TextTestProgressListener progress;
+ if ( doPrintProgress )
+ m_eventManager->addListener( &progress );
+ SuperClass *pThis = this;
+ pThis->run( *m_eventManager, testName );
-bool
-TestRunner::runTestByName( std::string testName,
- bool doPrintProgress )
-{
- if ( testName.empty() )
- return runTest( m_suite, doPrintProgress );
+ if ( doPrintProgress )
+ m_eventManager->removeListener( &progress );
- try
- {
- return runTest( m_suite->findTest( testName ), doPrintProgress );
- }
- catch ( std::invalid_argument & )
- {
- std::cout << "Test " << testName << " not found." << std::endl;
- }
- return false;
+ printResult( doPrintResult );
+ wait( doWait );
+
+ return m_result->wasSuccessful();
}
@@ -115,22 +92,6 @@ TestRunner::printResult( bool doPrintResult )
}
-bool
-TestRunner::runTest( Test *test,
- bool doPrintProgress )
-{
- TextTestProgressListener progress;
- if ( doPrintProgress )
- m_eventManager->addListener( &progress );
-
- m_eventManager->runTest( test );
-
- if ( doPrintProgress )
- m_eventManager->removeListener( &progress );
- return m_result->wasSuccessful();
-}
-
-
/*! Returns the result of the test run.
* Use this after calling run() to access the result of the test run.
*/