CppUnit project page FAQ

Public Member Functions | Private Attributes
TestSuite Class Reference

A Composite of Tests.It runs a collection of test cases. Here is an example. More...

#include <TestSuite.h>

Inheritance diagram for TestSuite:
Inheritance graph
[legend]
Collaboration diagram for TestSuite:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TestSuite (std::string name="")
 Default constructor.
 ~TestSuite ()
 Destructor.
void addTest (Test *test)
 Adds a test to the suite.
const CppUnitVector< Test * > & getTests () const
virtual void deleteContents ()
 Deletes all tests in the suite.
int getChildTestCount () const
 Returns the number of direct child of the test.
TestdoGetChildTestAt (int index) const
 Returns the child test of the specified valid index.
- Public Member Functions inherited from TestComposite
 TestComposite (const std::string &name="")
 ~TestComposite ()
void run (TestResult *result)
 Run the test, collecting results.
int countTestCases () const
 Return the number of test cases invoked by run().
std::string getName () const
 Returns the test name.
- Public Member Functions inherited from Test
virtual ~Test ()
virtual TestgetChildTestAt (int index) const
 Returns the child test of the specified index.
virtual bool findTestPath (const std::string &testName, TestPath &testPath) const
 Finds the test with the specified name and its parents test.
virtual bool findTestPath (const Test *test, TestPath &testPath) const
 Finds the specified test and its parents test.
virtual TestfindTest (const std::string &testName) const
 Finds the test with the specified name in the hierarchy.
virtual TestPath resolveTestPath (const std::string &testPath) const
 Resolved the specified test path with this test acting as 'root'.

Private Attributes

CppUnitVector< Test * > m_tests

Detailed Description

A Composite of Tests.

It runs a collection of test cases. Here is an example.

CppUnit::TestSuite *suite= new CppUnit::TestSuite();
suite->addTest(new CppUnit::TestCaller<MathTest> (
"testAdd", testAdd));
suite->addTest(new CppUnit::TestCaller<MathTest> (
"testDivideByZero", testDivideByZero));

Note that TestSuites assume lifetime control for any tests added to them.

TestSuites do not register themselves in the TestRegistry.

See also:
Test
TestCaller

Constructor & Destructor Documentation

CPPUNIT_NS_BEGIN TestSuite::TestSuite ( std::string  name = "")

Default constructor.

Constructs a test suite with the specified name.

TestSuite::~TestSuite ( )

Destructor.


Member Function Documentation

void TestSuite::addTest ( Test test)

Adds a test to the suite.

Adds the specified test to the suite.

Parameters:
testTest to add. Must not be NULL.
void TestSuite::deleteContents ( )
virtual

Deletes all tests in the suite.

Destroys all the tests of the suite.

Test * TestSuite::doGetChildTestAt ( int  index) const
virtual

Returns the child test of the specified valid index.

Parameters:
indexZero based valid index of the child test to return.
Returns:
Pointer on the test. Never NULL.

Implements Test.

Reimplemented in TestRunner::WrappingSuite.

int TestSuite::getChildTestCount ( ) const
virtual

Returns the number of direct child of the test.

Implements Test.

Reimplemented in TestRunner::WrappingSuite.

const CppUnitVector< Test * > & TestSuite::getTests ( ) const

Returns the list of the tests (DEPRECATED).

Deprecated:
Use getChildTestCount() & getChildTestAt() of the TestComposite interface instead.
Returns:
Reference on a vector that contains the tests of the suite.

Member Data Documentation

CppUnitVector<Test *> TestSuite::m_tests
private

The documentation for this class was generated from the following files:

Send comments to:
CppUnit Developers