|
| TestCaller (std::string name, TestMethod test) |
|
| TestCaller (std::string name, TestMethod test, Fixture &fixture) |
|
| TestCaller (std::string name, TestMethod test, Fixture *fixture) |
|
| TestCaller (std::string name, std::function< void()> test_function, Fixture *fixture) |
|
| ~TestCaller () |
|
void | runTest () |
| FIXME: this should probably be pure virtual. More...
|
|
void | setUp () |
| Set up context before running a test. More...
|
|
void | tearDown () |
| Clean up after the test run. More...
|
|
std::string | toString () const |
|
| TestCase (const std::string &name) |
| Constructs a test case. More...
|
|
| TestCase () |
| Constructs a test case for a suite. More...
|
|
| ~TestCase () |
| Destructs a test case. More...
|
|
virtual void | run (TestResult *result) |
| Run the test and catch any exceptions that are triggered by it. More...
|
|
std::string | getName () const |
| Returns the name of the test case. More...
|
|
virtual void | runTest () |
| FIXME: this should probably be pure virtual. More...
|
|
int | countTestCases () const |
|
int | getChildTestCount () const |
|
Test * | doGetChildTestAt (int index) const |
|
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...
|
|
virtual | ~TestFixture () |
|
virtual void | setUp () |
| Set up context before running a test. More...
|
|
virtual void | tearDown () |
| Clean up after the test run. More...
|
|
template<class Fixture>
class TestCaller< Fixture >
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:
class MathTest : public CppUnit::TestFixture {
...
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 TestFixture class, as long as it accepts void and returns void.
- See also
- TestCase