CppUnit - The Unit Testing Library

CppUnit project page | FAQ

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
7 CPPUNIT_NS_BEGIN
8
9
10class TestResult;
11class TestPath;
12
25 class CPPUNIT_API Test
26{
27public:
28 virtual ~Test() {};
29
32 virtual void run( TestResult *result ) =0;
33
40 virtual int countTestCases () const =0;
41
44 virtual int getChildTestCount() const =0;
45
57 virtual Test *getChildTestAt( int index ) const;
58
64 virtual std::string getName () const =0;
65
72 virtual bool findTestPath( const std::string &testName,
73 TestPath &testPath ) const;
74
81 virtual bool findTestPath( const Test *test,
82 TestPath &testPath ) const;
83
89 virtual Test *findTest( const std::string &testName ) const;
90
97 virtual TestPath resolveTestPath( const std::string &testPath ) const;
98
99protected:
104 virtual void checkIsValidIndex( int index ) const;
105
110 virtual Test *doGetChildTestAt( int index ) const =0;
111};
112
113
114 CPPUNIT_NS_END
115
116#endif // CPPUNIT_TEST_H
117
CPPUNIT_API
#define CPPUNIT_API
Definition CppUnitApi.h:27
Portability.h
CPPUNIT_NS_END
#define CPPUNIT_NS_END
Definition Portability.h:106
CPPUNIT_NS_BEGIN
#define CPPUNIT_NS_BEGIN
Definition Portability.h:105
Test
Base class for all test objects.
Definition Test.h:26
Test::getChildTestAt
virtual Test * getChildTestAt(int index) const
Returns the child test of the specified index.
Definition Test.cpp:11
Test::getName
virtual std::string getName() const =0
Returns the test name.
Test::checkIsValidIndex
virtual void checkIsValidIndex(int index) const
Definition Test.cpp:90
Test::findTestPath
virtual bool findTestPath(const std::string &testName, TestPath &testPath) const
Finds the test with the specified name and its parents test.
Definition Test.cpp:32
Test::getChildTestCount
virtual int getChildTestCount() const =0
Returns the number of direct child of the test.
Test::run
virtual void run(TestResult *result)=0
Run the test, collecting results.
Test::resolveTestPath
virtual TestPath resolveTestPath(const std::string &testPath) const
Resolved the specified test path with this test acting as 'root'.
Definition Test.cpp:82
Test::countTestCases
virtual int countTestCases() const =0
Return the number of test cases invoked by run().
Test::~Test
virtual ~Test()
Definition Test.h:28
Test::doGetChildTestAt
virtual Test * doGetChildTestAt(int index) const =0
Returns the child test of the specified valid index.
Test::findTest
virtual Test * findTest(const std::string &testName) const
Finds the test with the specified name in the hierarchy.
Definition Test.cpp:19
TestPath
A List of Test representing a path to access a Test.
Definition TestPath.h:30
TestResult
Manages TestListener.
Definition TestResult.h:48

| Send comments to: CppUnit Developers