CppUnit project page FAQ CppUnit home page

Test.h
Go to the documentation of this file.
1 #ifndef CPPUNIT_TEST_H
2 #define CPPUNIT_TEST_H
3 
4 #include <cppunit/Portability.h>
5 #include <string>
6 #include <vector>
7 
9 
10 
11 class TestResult;
12 class TestPath;
13 
27 {
28 public:
29  static unsigned long disabledCount;
30  static unsigned long ignoredCount;
31  enum Type { NORMAL, IGNORED, DISABLED };
33  Test() : _type(NORMAL) {}
35  _type = t;
36  if (t == IGNORED) ++ignoredCount;
37  if (t == DISABLED) ++disabledCount;
38  return *this;
39  }
40  Type getType() const { return _type; }
41 
42  virtual ~Test() {};
43 
46  virtual void run( TestResult *result ) =0;
47 
54  virtual int countTestCases () const =0;
55 
58  virtual int getChildTestCount() const =0;
59 
71  virtual Test *getChildTestAt( int index ) const;
72 
78  virtual std::string getName () const =0;
79 
86  virtual bool findTestPath( const std::string &testName,
87  TestPath &testPath ) const;
88 
95  virtual bool findTestPath( const Test *test,
96  TestPath &testPath ) const;
97 
103  virtual Test *findTest( const std::string &testName ) const;
104 
111  virtual TestPath resolveTestPath( const std::string &testPath ) const;
112 
114  struct Filter {
115  virtual ~Filter() {}
116  virtual bool include(const std::string& testName) const = 0;
117  };
118  virtual bool filter(const Filter&) = 0;
119 
120 protected:
125  virtual void checkIsValidIndex( int index ) const;
126 
131  virtual Test *doGetChildTestAt( int index ) const =0;
132 };
133 
134 
136 
137 #endif // CPPUNIT_TEST_H
138 
static unsigned long ignoredCount
Definition: Test.h:30
Type
Definition: Test.h:31
Manages TestListener.A single instance of this class is used when running the test. It is usually created by the test runner (TestRunner).
Definition: TestResult.h:51
Base class for all test objects.All test objects should be a subclass of Test. Some test objects...
Definition: Test.h:26
Type getType() const
Definition: Test.h:40
static unsigned long disabledCount
Definition: Test.h:29
Test()
Definition: Test.h:33
#define CPPUNIT_NS_END
Definition: Portability.h:120
Type _type
Definition: Test.h:32
#define CPPUNIT_NS_BEGIN
Definition: Portability.h:119
A List of Test representing a path to access a Test.The path can be converted to a string and resolve...
Definition: TestPath.h:34
Use this filter to only run some of the registered tests.
Definition: Test.h:114
virtual ~Filter()
Definition: Test.h:115
virtual ~Test()
Definition: Test.h:42
Test & setType(Type t)
Definition: Test.h:34
#define CPPUNIT_API
Definition: CppUnitApi.h:27

SourceForge Logo hosts this site. Send comments to:
CppUnit Developers