summaryrefslogtreecommitdiff
path: root/include/cppunit/TextTestRunner.h
blob: 1310defc64f0460519adfce8dda8b3477a09421c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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