CppUnit project page | FAQ

Public Member Functions | Private Member Functions | Private Attributes | List of all members
TestComposite Class Reference

A Composite of Tests. More...

`#include <TestComposite.h>`

Inheritance diagram for TestComposite:
[legend]
Collaboration diagram for TestComposite:
[legend]

## Public Member Functions
| TestComposite (const std::string &name="")
| ~TestComposite ()
void | run (TestResult *result)
| Run the test, collecting results. More...
int | countTestCases () const
| Return the number of test cases invoked by run(). More...
std::string | getName () const
| Returns the test name. More...
Public Member Functions inherited from Test
virtual | ~Test ()
virtual void | run (TestResult *result)=0
| Run the test, collecting results. More...
virtual int | countTestCases () const =0
| Return the number of test cases invoked by run(). More...
virtual int | getChildTestCount () const =0
| Returns the number of direct child of the test. More...
virtual Test * | getChildTestAt (int index) const
| Returns the child test of the specified index. More...
virtual std::string | getName () const =0
| Returns the test name. More...
virtual bool | findTestPath (const std::string &testName, TestPath &testPath) const
| Finds the test with the specified name and its parents test. More...
virtual bool | findTestPath (const Test *test, TestPath &testPath) const
| Finds the specified test and its parents test. More...
virtual Test * | findTest (const std::string &testName) const
| Finds the test with the specified name in the hierarchy. More...
virtual TestPath | resolveTestPath (const std::string &testPath) const
| Resolved the specified test path with this test acting as 'root'. More...

## Private Member Functions
| TestComposite (const TestComposite &other)
TestComposite & | operator= (const TestComposite &other)
virtual void | doStartSuite (TestResult *controller)
virtual void | doRunChildTests (TestResult *controller)
virtual void | doEndSuite (TestResult *controller)

## Private Attributes
const std::string | m_name

## Additional Inherited Members
Protected Member Functions inherited from Test
virtual void | checkIsValidIndex (int index) const
virtual Test * | doGetChildTestAt (int index) const =0
| Returns the child test of the specified valid index. More...

## Detailed Description

A Composite of Tests.

Base class for all test composites. Subclass this class if you need to implement a custom TestSuite.

See also
  Test, TestSuite.

## Constructor & Destructor Documentation

## ◆ TestComposite() [1/2]

CPPUNIT_NS_BEGIN TestComposite::TestComposite | ( | const std::string & | name = `""` | ) |

## ◆ ~TestComposite()

TestComposite::~TestComposite | ( |  | ) |

## ◆ TestComposite() [2/2]

TestComposite::TestComposite | ( | const TestComposite & | other | ) |
| private

## Member Function Documentation

## ◆ countTestCases()

int TestComposite::countTestCases | ( |  | ) | const
| virtual

Return the number of test cases invoked by run().

The base unit of testing is the class TestCase. This method returns the number of TestCase objects invoked by the run() method.

Implements Test.

## ◆ doEndSuite()

void TestComposite::doEndSuite | ( | TestResult * | controller | ) |
| private virtual

## ◆ doRunChildTests()

void TestComposite::doRunChildTests | ( | TestResult * | controller | ) |
| private virtual

## ◆ doStartSuite()

void TestComposite::doStartSuite | ( | TestResult * | controller | ) |
| private virtual

## ◆ getName()

std::string TestComposite::getName | ( |  | ) | const
| virtual

Returns the test name.

Each test has a name. This name may be used to find the test in a suite or registry of tests.

Implements Test.

Reimplemented in TestRunner::WrappingSuite.

## ◆ operator=()

TestComposite & TestComposite::operator= | ( | const TestComposite & | other | ) |
| private

## ◆ run()

void TestComposite::run | ( | TestResult * | result | ) |
| virtual

Run the test, collecting results.

Implements Test.

Reimplemented in TestRunner::WrappingSuite.

## Member Data Documentation

## ◆ m_name

const std::string TestComposite::m_name
| private

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

- TestComposite.h
- TestComposite.cpp

| Send comments to: CppUnit Developers