CppUnit project page | FAQ | CppUnit home page |
#include <TestCaller.h>
Inheritance diagram for CppUnit::TestCaller:
Public Methods | |
TestCaller (std::string name, TestMethod test) | |
Constructor for TestCaller. More... | |
TestCaller (std::string name, TestMethod test, Fixture &fixture) | |
Constructor for TestCaller. More... | |
TestCaller (std::string name, TestMethod test, Fixture *fixture) | |
Constructor for TestCaller. More... | |
~TestCaller () | |
Protected Methods | |
void | runTest () |
All the work for runTest is deferred to subclasses. More... | |
void | setUp () |
A hook for fixture set up. More... | |
void | tearDown () |
A hook for fixture tear down. More... | |
std::string | toString () const |
Returns the name of the test case instance. More... | |
Private Types | |
typedef void(Fixture::* | TestMethod )() |
Private Methods | |
TestCaller (const TestCaller &other) | |
TestCaller & | operator= (const TestCaller &other) |
Private Attributes | |
bool | m_ownFixture |
Fixture * | m_fixture |
TestMethod | m_test |
A test caller provides access to a test case method on a test case 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 TestCase.
Here is an example:
class MathTest : public CppUnit::TestCase { ... public: void setUp (); void tearDown (); void testAdd (); void testSubtract (); }; CppUnit::Test *MathTest::suite () { CppUnit::TestSuite *suite = new CppUnit::TestSuite; suite->addTest (new CppUnit::TestCaller<MathTest> ("testAdd", testAdd)); return suite; }
You can use a TestCaller to bind any test method on a TestCase class, as long as it accepts void and returns void.
|
|
|
Constructor for TestCaller. This constructor builds a new Fixture instance owned by the TestCaller.
|
|
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.
|
|
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.
|
|
|
|
|
|
|
|
All the work for runTest is deferred to subclasses.
Reimplemented from CppUnit::TestCase. |
|
A hook for fixture set up.
Reimplemented from CppUnit::TestCase. |
|
A hook for fixture tear down.
Reimplemented from CppUnit::TestCase. |
|
Returns the name of the test case instance.
Reimplemented from CppUnit::TestCase. |
|
|
|
|
|
|
|
hosts this site. |
Send comments to: CppUnit Developers |