#include <Pt/Unit/TestCase.h>
Single test with setup and teardown.
More...
Inherits Test, and TestFixture.
|
|
virtual void | test ()=0 |
| | Implements the actual test procedure When the test is run, this method will be called after setUp and before tearDown.
|
| |
A TestCase can be used for simple tests that require a initialization and deinitialization of resources. The implementor is supposed to implement the abstract method 'test' and the methods 'setUp' and 'tearDown' for resource management. When the test is run, 'setUp' will be called first, then 'test' and finally 'tearDown'.
{
public:
MyTest()
{}
{
}
{
}
{
}
};
Once the test is written it can be registered to an application by using the RegisterTest class template.
◆ TestCase()
Constructs a TestCase with the passed name.
- Parameters
-
◆ setUp()
This function is called before each registered tester function is invoked. It is meant to initialize any required resources.
Reimplemented from TestFixture.
◆ tearDown()
| virtual void tearDown |
( |
| ) |
|
|
virtual |
This function is called after each registered tester function is invoked. It is meant to remove any resources previously initialized in TestCase::setUp.
Reimplemented from TestFixture.
◆ 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()
| 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()
| void reportMessage |
( |
const std::string & |
msg | ) |
|
|
inherited |
This signal can be sent to report informational messages.