CppUnit - The Unit Testing Library

CppUnit project page | FAQ

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

Decorator for Tests. More...

`#include <TestDecorator.h>`

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

## Public Member Functions
| TestDecorator (Test *test)
| ~TestDecorator ()
int | countTestCases () const
| Return the number of test cases invoked by run().
std::string | getName () const
| Returns the test name.
void | run (TestResult *result)
| Run the test, collecting results.
int | getChildTestCount () const
| Returns the number of direct child of the test.
Public Member Functions inherited from Test
virtual | ~Test ()
virtual Test * | getChildTestAt (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 Test * | findTest (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'.

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

## Protected Attributes
Test * | m_test

## Private Member Functions
| TestDecorator (const TestDecorator &)
void | operator= (const TestDecorator &)

## Detailed Description

Decorator for Tests.

TestDecorator provides an alternate means to extend functionality of a test class without subclassing the test. Instead, one can subclass the decorater and use it to wrap the test class.

Assumes ownership of the test it decorates

## Constructor & Destructor Documentation

## ◆ TestDecorator() [1/2]

CPPUNIT_NS_BEGIN TestDecorator::TestDecorator | ( | Test * | test | ) |

## ◆ ~TestDecorator()

TestDecorator::~TestDecorator | ( |  | ) |

## ◆ TestDecorator() [2/2]

TestDecorator::TestDecorator | ( | const TestDecorator & |  | ) |
| private

## Member Function Documentation

## ◆ countTestCases()

int TestDecorator::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.

## ◆ doGetChildTestAt()

Test * TestDecorator::doGetChildTestAt | ( | int | index | ) | const
| protectedvirtual

Returns the child test of the specified valid index.

Parameters

  index | Zero based valid index of the child test to return.

Returns
  Pointer on the test. Never `NULL`.

Implements Test.

## ◆ getChildTestCount()

int TestDecorator::getChildTestCount | ( |  | ) | const
| virtual

Returns the number of direct child of the test.

Implements Test.

## ◆ getName()

std::string TestDecorator::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.

## ◆ operator=()

void TestDecorator::operator= | ( | const TestDecorator & |  | ) |
| private

## ◆ run()

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

Run the test, collecting results.

Implements Test.

Reimplemented in TestSetUp.

## Member Data Documentation

## ◆ m_test

Test* TestDecorator::m_test
| protected

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

- TestDecorator.h
- TestDecorator.cpp

| Send comments to: CppUnit Developers