summaryrefslogtreecommitdiff
path: root/include/cppunit/TextTestRunner.h
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2001-05-19 10:29:11 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2001-05-19 10:29:11 +0000
commitfed3ef0b01704ee7fd9f41e8cbb706da38c004fe (patch)
tree3a83cb3a8a0c46dfcefcfb6ed5b72c6865b717e0 /include/cppunit/TextTestRunner.h
parent5d704cbbd7928e8a3baec2e18c8d7e0e6089dc6e (diff)
downloadcppunit-fed3ef0b01704ee7fd9f41e8cbb706da38c004fe.tar.gz
* Merged Steve M. Robbins patch to replace assertImplementation with assert in hierarchy example.
* Added a TextTestRunner to runner tests. It is based on Michael Feather's version, but have been rewriten. * Removed traces that printed the test name in TextTestResult while running. * Added the test name to error and failure report in TextTestResult. * Updated hierarchy example to use TextTestRunner.
Diffstat (limited to 'include/cppunit/TextTestRunner.h')
-rw-r--r--include/cppunit/TextTestRunner.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/include/cppunit/TextTestRunner.h b/include/cppunit/TextTestRunner.h
new file mode 100644
index 0000000..1310def
--- /dev/null
+++ b/include/cppunit/TextTestRunner.h
@@ -0,0 +1,52 @@
+#ifndef CPPUNIT_TEXTTESTRUNNER_H
+#define CPPUNIT_TEXTTESTRUNNER_H
+
+#include <string>
+#include <vector>
+
+namespace CppUnit {
+
+class Test;
+class TestSuite;
+
+/**
+ * A text mode test runner.
+ *
+ * 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.
+ *
+ * Here is an example of use:
+ *
+ * \code
+ * TextTestRunner runner;
+ * runner.addTest( ExampleTestCase::suite() );
+ * runner.run( "", true ); // Run all tests and wait
+ * \endcode
+ */
+class TextTestRunner
+{
+public:
+ TextTestRunner();
+ virtual ~TextTestRunner();
+
+ void run( std::string testName ="",
+ bool wait = false );
+
+ void addTest( Test *test );
+
+protected:
+ void runTest( Test *test );
+ void runTestByName( std::string testName );
+ void wait( bool doWait );
+
+ Test *findTestByName( std::string name ) const;
+ TestSuite *m_suite;
+};
+
+} // namespace CppUnit
+
+#endif // CPPUNIT_TEXTTESTRUNNER_H \ No newline at end of file