#include <Pt/Unit/Test.h>
Test base class
More...
Inherits NonCopyable.
Inherited by Application [private], TestCase, and .
|
| | Test (const std::string &name) |
| | Construct a test by name.
|
This is the base class for all types of tests that can be registered and run in a test application. It provides a virtual method run that is overriden by the derived classes and signals to inform about events that occur while the test is run.
◆ Test()
| Test |
( |
const std::string & | name | ) |
|
|
explicitprotected |
◆ run()
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.
◆ reportFinish()
This signal is sent when the test finished. It does not indicate that the test was successful.
◆ reportSuccess()
This signal is sent when the test was successful.
◆ reportAssertion()
This signal is sent when a assertion failed.
◆ reportException()
template<class C>
| void reportException |
( |
const TestContext & | ctx, |
|
|
const std::exception & | ex ) |
|
inherited |
This signal is sent when a regular std::exception occured.
◆ reportError()
This signal is sent when an unknown error occured.
◆ reportMessage()
template<class C>
| void reportMessage |
( |
const std::string & | msg | ) |
|
|
inherited |
This signal can be sent to report informational messages.