CppUnit project page | FAQ |
Generate a test case from a fixture method.A test caller provides access to a test case method on a test fixture class. Test callers are useful when you want to run an individual test or add it to a suite. Test Callers invoke only one Test (i.e. test method) on one Fixture of a TestFixture. More...
#include <TestCaller.h>
Public Member Functions | |
TestCaller (std::string name, TestMethod test) | |
TestCaller (std::string name, TestMethod test, Fixture &fixture) | |
TestCaller (std::string name, TestMethod test, Fixture *fixture) | |
~TestCaller () | |
void | runTest () |
FIXME: this should probably be pure virtual. | |
void | setUp () |
Set up context before running a test. | |
void | tearDown () |
Clean up after the test run. | |
std::string | toString () const |
Public Member Functions inherited from TestCase | |
TestCase (const std::string &name) | |
Constructs a test case. | |
TestCase () | |
Constructs a test case for a suite. | |
~TestCase () | |
Destructs a test case. | |
virtual void | run (TestResult *result) |
Run the test and catch any exceptions that are triggered by it. | |
std::string | getName () const |
Returns the name of the test case. | |
Public Member Functions inherited from TestLeaf | |
int | countTestCases () const |
int | getChildTestCount () const |
Test * | doGetChildTestAt (int index) const |
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'. | |
Public Member Functions inherited from TestFixture | |
virtual | ~TestFixture () |
Private Types | |
typedef void(Fixture::* | TestMethod )() |
Private Member Functions | |
TestCaller (const TestCaller &other) | |
TestCaller & | operator= (const TestCaller &other) |
Private Attributes | |
bool | m_ownFixture |
Fixture * | m_fixture |
TestMethod | m_test |
Generate a test case from a fixture method.
A test caller provides access to a test case method on a test fixture class. Test callers are useful when you want to run an individual test or add it to a suite. Test Callers invoke only one Test (i.e. test method) on one Fixture of a TestFixture.
Here is an example:
You can use a TestCaller to bind any test method on a TestFixture class, as long as it accepts void and returns void.
|
private |
|
inline |
Constructor for TestCaller. This constructor builds a new Fixture instance owned by the TestCaller.
name | name of this TestCaller |
test | the method this TestCaller calls in runTest() |
|
inline |
Constructor for TestCaller. This constructor does not create a new Fixture instance but accepts an existing one as parameter. The TestCaller will not own the Fixture object.
name | name of this TestCaller |
test | the method this TestCaller calls in runTest() |
fixture | the Fixture to invoke the test method on. |
|
inline |
Constructor for TestCaller. This constructor does not create a new Fixture instance but accepts an existing one as parameter. The TestCaller will own the Fixture object and delete it in its destructor.
name | name of this TestCaller |
test | the method this TestCaller calls in runTest() |
fixture | the Fixture to invoke the test method on. |
|
inline |
|
private |
|
private |
|
inlinevirtual |
FIXME: this should probably be pure virtual.
All the work for runTest is deferred to subclasses.
Reimplemented from TestCase.
|
inlinevirtual |
Set up context before running a test.
Reimplemented from TestFixture.
|
inlinevirtual |
Clean up after the test run.
Reimplemented from TestFixture.
|
inline |
|
private |
|
private |
|
private |
Send comments to: CppUnit Developers |