summaryrefslogtreecommitdiff
path: root/include/cppunit/ui/text/TextTestRunner.h
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2002-07-13 09:33:50 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2002-07-13 09:33:50 +0000
commitf1bf3276752a10a2cdf4e3cf3087399d199c4566 (patch)
tree13dc67edcf465f44b9fe835f5e0b201511774d07 /include/cppunit/ui/text/TextTestRunner.h
parent570132ec2707c8bac6c27c758254f05e293fe613 (diff)
downloadcppunit-f1bf3276752a10a2cdf4e3cf3087399d199c4566.tar.gz
Include/cppunit/ui/text/TestRunner.
include/cppunit/ui/text/TestRunner.h: * src/cppunit/TextTestRunner.cpp: Renamed TextUi::TestRunner TextTestRunner and moved it to the CppUnit namespace. Added a deprecated typedef for compatibility with previous version. * include/cppunit/ui/text/TextTestRunner.h: added. * include/cppunit/ui/mfc/TestRunner.h: * src/cppunit/msvc6/testrunner/TestRunner.cpp: Renamed MfcUi::TestRunner MfcTestRunner. Added deprecated typedef for compatibility. Renamed TestRunner.cpp to MfcTestRunner.cpp. * include/cppunit/ui/mfc/MfcTestRunner.h: added. * include/cppunit/ui/qt/TestRunner.h: * src/qttestrunner/TestRunner.cpp: renamed QtUi::TestRunner QtTestRunner and moved it to CppUnit namespace. Added a deprecated typedef for compatibility. Renamed TestRunner.cpp to QtTestRunner.cpp. * include/cppunit/ui/qt/TestRunner.h: * src/qttestrunner/TestRunner.h: Moved TestRunner to CppUnit namespace and renamed it QtTestRunner. Added deprecated typedef for compatibility. * include/cppunit/Asserter.h: * src/cppunit/Asserter.cpp: changed namespace Asserter to a struct and made all methods static. * include/cppunit/extensions/HelperMacros.h: * include/cppunit/extensions/SourceLine.h: * include/cppunit/extensions/TestAssert.h: * include/cppunit/extensions/TestPlugIn.h: * include/cppunit/Portability.h: changed CPPUNIT_NS(symbol) to a symbol macro that expand either to CppUnit or nothing. The symbol is no longer a parameter. * include/cppunit/portability/CppUnitVector.h: * include/cppunit/portability/CppUnitDeque.h: * include/cppunit/portability/CppUnitMap.h: added. STL Wrapper for compilers that do not support template default argumenent and need the allocator to be passed when instantiating STL container. * examples/cppunittest/*.h: * examples/cppunittest/*.cpp: * src/msvc6/testrunner/*.h: * src/msvc6/testrunner/*.cpp: * src/msvc6/testpluginrunner/*.h: * src/msvc6/testpluginrunner/*.cpp: * src/qttestrunner/*.h: * src/qttestrunner/*.cpp: replaced occurence of CppUnit:: by CPPUNIT_NS. * src/cppunit/TestSuite.h: replaced occurence of std::vector by CppUnitVector.
Diffstat (limited to 'include/cppunit/ui/text/TextTestRunner.h')
-rw-r--r--include/cppunit/ui/text/TextTestRunner.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/include/cppunit/ui/text/TextTestRunner.h b/include/cppunit/ui/text/TextTestRunner.h
new file mode 100644
index 0000000..dee37a7
--- /dev/null
+++ b/include/cppunit/ui/text/TextTestRunner.h
@@ -0,0 +1,94 @@
+#ifndef CPPUNIT_TEXTTESTRUNNER_H
+#define CPPUNIT_TEXTTESTRUNNER_H
+
+
+#include <cppunit/Portability.h>
+#include <string>
+#include <vector>
+#include <cppunit/TestRunner.h>
+
+CPPUNIT_NS_BEGIN
+
+
+class Outputter;
+class Test;
+class TestSuite;
+class TextOutputter;
+class TestResult;
+class TestResultCollector;
+
+
+
+/*!
+ * \brief A text mode test runner.
+ * \ingroup WritingTestResult
+ * \ingroup ExecutingTest
+ *
+ * The test runner manage the life cycle of the added tests.
+ *
+ * The test runner can run only one of the added tests or all the tests.
+ *
+ * TestRunner prints out a trace as the tests are executed followed by a
+ * summary at the end. The trace and summary print are optional.
+ *
+ * Here is an example of use:
+ *
+ * \code
+ * CppUnit::TextTestRunner runner;
+ * runner.addTest( ExampleTestCase::suite() );
+ * runner.run( "", true ); // Run all tests and wait
+ * \endcode
+ *
+ * The trace is printed using a TextTestProgressListener. The summary is printed
+ * using a TextOutputter.
+ *
+ * You can specify an alternate Outputter at construction
+ * or later with setOutputter().
+ *
+ * After construction, you can register additional TestListener to eventManager(),
+ * for a custom progress trace, for example.
+ *
+ * \code
+ * CppUnit::TextTestRunner runner;
+ * runner.addTest( ExampleTestCase::suite() );
+ * runner.setOutputter( CppUnit::CompilerOutputter::defaultOutputter(
+ * &runner.result(),
+ * std::cerr ) );
+ * MyCustomProgressTestListener progress;
+ * runner.eventManager().addListener( &progress );
+ * runner.run( "", true ); // Run all tests and wait
+ * \endcode
+ *
+ * \see CompilerOutputter, XmlOutputter, TextOutputter.
+ */
+class CPPUNIT_API TextTestRunner : public CPPUNIT_NS::TestRunner
+{
+public:
+ TextTestRunner( Outputter *outputter =NULL );
+
+ virtual ~TextTestRunner();
+
+ bool run( std::string testPath ="",
+ bool doWait = false,
+ bool doPrintResult = true,
+ bool doPrintProgress = true );
+
+ void setOutputter( Outputter *outputter );
+
+ TestResultCollector &result() const;
+
+ TestResult &eventManager() const;
+
+protected:
+ virtual void wait( bool doWait );
+ virtual void printResult( bool doPrintResult );
+
+ TestResultCollector *m_result;
+ TestResult *m_eventManager;
+ Outputter *m_outputter;
+};
+
+
+CPPUNIT_NS_END
+
+#endif // CPPUNIT_TEXTTESTRUNNER_H