#include <Pt/Unit/Test.h>

Public Member Functions | |
| virtual | ~Test () |
| Destructor. | |
| virtual void | run ()=0 |
| Runs the test. | |
| const std::string & | name () const |
| 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) |
| Test * | parent () |
| const Test * | parent () const |
| void | attachReporter (Reporter &r) |
| Add reporter for test events. | |
| void | detachReporter (Reporter &r) |
Protected Member Functions | |
| Test (const std::string &name) | |
| Construct a test by name. | |
| Test | ( | const std::string & | name | ) | [explicit, protected] |
| name | Name of the test |
| virtual void run | ( | ) | [pure virtual] |
Derived test classes are supposed to implement this method to run the test procedure. A derived class should send the 'started' signal at the begin of the test and send the 'finished' signal at the end of the test. If the test was successful, the 'success' signal is sent, otheriwse one of the signals indicating a failrue. In case of a failed assertion, the signal 'assertion' is sent, if a regular std::exception was the cause of the error the signal 'exception' is sent and and the signal 'error' indicates an unknown exception or error. This method should not propagate any exceptions
Implemented in Application, TestCase, and TestSuite.
| void reportFinish | ( | const TestContext & | ctx | ) |
This signal is sent when the test finished. It does not indicate that the test was successful.
| void reportSuccess | ( | const TestContext & | ctx | ) |
This signal is sent when the test was successful.
| void reportAssertion | ( | const TestContext & | ctx, | |
| const Assertion & | ass | |||
| ) |
This signal is sent when a assertion failed.
| void reportException | ( | const TestContext & | ctx, | |
| const std::exception & | ex | |||
| ) |
This signal is sent when a regular std::exception occured.
| void reportError | ( | const TestContext & | ctx | ) |
This signal is sent when an unknown error occured.
| void reportMessage | ( | const std::string & | msg | ) |
This signal can be sent to report informational messages.
| void attachReporter | ( | Reporter & | r | ) |
Adds the reporter r to report test events. The caller owns the reporter and must make sure it lives as long as the test.
Reimplemented in Application.