|
| | TestSuite (const std::string &name, TestProtocol &protocol=TestSuite::defaultProtocol) |
| | Construct by name and protocol.
|
|
| ~TestSuite () |
| | Destructor.
|
|
void | setProtocol (TestProtocol *protocol) |
| | Sets the protocol.
|
| virtual void | setUp () |
| | Set up conText before running a test.
|
| virtual void | tearDown () |
| | Clean up after the test run.
|
| virtual void | run () |
| | Runs the test suite.
|
| void | runTest (const std::string &name, const SerializationInfo *args=0, std::size_t argCount=0) |
| | Runs a registered test.
|
|
void | runAll () |
| | Runs all tests.
|
|
const std::string & | name () const |
| | Returns the name of the test.
|
|
void | reportStart (const TestContext &ctx) |
| | Reports the start of a test.
|
| void | reportFinish (const TestContext &ctx) |
| | Finished notification.
|
| void | reportSuccess (const TestContext &ctx) |
| | Success notification.
|
| void | reportAssertion (const TestContext &ctx, const Assertion &ass) |
| | Assertion notification.
|
| void | reportException (const TestContext &ctx, const std::exception &ex) |
| | Exception notification.
|
| void | reportError (const TestContext &ctx) |
| | Error notification.
|
| void | reportMessage (const std::string &msg) |
| | Message notification.
|
|
void | setParent (Test *test) |
| | Sets the parent test.
|
|
Test * | parent () |
| | Returns the parent test.
|
|
const Test * | parent () const |
| | Returns the parent test.
|
|
void | attachReporter (Reporter &r) |
| | Add reporter for test events.
|
|
void | detachReporter (Reporter &r) |
| | Removes a reporter.
|
The TestSuite is used to implement protocol and data driven tests. It inherits its ability to register methods and properties from Reflectable. The implementor is supposed to write and register the required test methods on construction.
{
public:
MyTest()
{
this->registerMethod("Run", *this, &MyTest::Run);
}
void Run()
{
}
};
Protocol and data driven testing.
Definition TestSuite.h:84
TestSuite(const std::string &name, TestProtocol &protocol=TestSuite::defaultProtocol)
Construct by name and protocol.
#define PT_UNIT_ASSERT(cond)
Asserts that a condition is true.
Definition Assertion.h:119
Protocol and data driven unit testing framework.
Core module.
Definition Allocator.h:33
Registers tests to an application.
Definition RegisterTest.h:59
Once the test is written it can be registered to an application by using the RegisterTest class template. Include TestMain.h in exactly one source file to provide a main() function.
The default protocol will run each registered test method when the test is run. Before each test method setUp() is called and tearDown() after each test. The TestProtocol can be replaced with a customised one and reflection can be used to call any method multiple times with the required data.