class ConsoleListener listens to any messages reported by the tests during the test run, formates them and print them to the standard output.
More...
#include <robottestingframework/ConsoleListener.h>
class ConsoleListener listens to any messages reported by the tests during the test run, formates them and print them to the standard output.
Here's an example of using a ConsoleListener:
#include <cstdio>
#include <iostream>
class MyTest : public TestCase
{
public:
MyTest() :
TestCase("MyTest")
{
}
bool setup(int argc, char** argv) override
{
return true;
}
void tearDown() override
{
}
void run() override
{
int a = 5;
int b = 3;
}
};
int main(int argc, char** argv)
{
TestResultCollector collector;
TestResult result;
result.addListener(&listener);
result.addListener(&collector);
MyTest atest;
atest.TestCase::run(result);
return collector.failedCount();
}
#define ROBOTTESTINGFRAMEWORK_ASSERT_ERROR(message)
Assertion with throwing error exception.
#define ROBOTTESTINGFRAMEWORK_TEST_CHECK(condition, message)
ROBOTTESTINGFRAMEWORK_TEST_CHECK combines ROBOTTESTINGFRAMEWORK_TEST_REPORT and ROBOTTESTINGFRAMEWORK...
#define ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF_FALSE(condition, message)
Conditional failure report.
#define ROBOTTESTINGFRAMEWORK_TEST_REPORT(message)
Reporting a message to the TestResult.
static std::string format(const char *msg,...)
format can be used to format data to in the same way that sprintf formats.
ConsoleListener(bool verbose=false)
ConsoleListener constructor.
Definition at line 38 of file ConsoleListener.h.
◆ ConsoleListener()
| robottestingframework::ConsoleListener::ConsoleListener |
( |
bool |
verbose = false | ) |
|
ConsoleListener constructor.
- Parameters
-
| verbose | enables the verbose mode. If true, the source file and the line number where the messages are issued by the tests will be written to the standard output. The verbose mode is disabled by default. |
◆ ~ConsoleListener()
| virtual robottestingframework::ConsoleListener::~ConsoleListener |
( |
| ) |
|
|
virtual |
◆ addError()
| void robottestingframework::ConsoleListener::addError |
( |
const Test * |
test, |
|
|
TestMessage |
msg |
|
) |
| |
|
overridevirtual |
This is called when an error occurred during test run.
- Parameters
-
| test | pointer to the corresponding test |
| msg | correspoinding error message |
Reimplemented from robottestingframework::TestListener.
◆ addFailure()
| void robottestingframework::ConsoleListener::addFailure |
( |
const Test * |
test, |
|
|
TestMessage |
msg |
|
) |
| |
|
overridevirtual |
This is called when a failure occurred during test run.
- Parameters
-
| test | pointer to the corresponding test |
| msg | correspoinding failure message |
Reimplemented from robottestingframework::TestListener.
◆ addReport()
| void robottestingframework::ConsoleListener::addReport |
( |
const Test * |
test, |
|
|
TestMessage |
msg |
|
) |
| |
|
overridevirtual |
This is called to report any arbitrary message from tests.
- Parameters
-
| test | pointer to the corresponding test |
| msg | correspoinding error message |
Reimplemented from robottestingframework::TestListener.
◆ endTest()
| void robottestingframework::ConsoleListener::endTest |
( |
const Test * |
test | ) |
|
|
overridevirtual |
◆ endTestRunner()
| void robottestingframework::ConsoleListener::endTestRunner |
( |
| ) |
|
|
overridevirtual |
◆ endTestSuite()
| void robottestingframework::ConsoleListener::endTestSuite |
( |
const Test * |
test | ) |
|
|
overridevirtual |
◆ hideUncriticalMessages()
| void robottestingframework::ConsoleListener::hideUncriticalMessages |
( |
| ) |
|
hideUncriticalMessages hides the tests report messages and only shows the test assertion failure and error messages.
◆ startTest()
| void robottestingframework::ConsoleListener::startTest |
( |
const Test * |
test | ) |
|
|
overridevirtual |
◆ startTestRunner()
| void robottestingframework::ConsoleListener::startTestRunner |
( |
| ) |
|
|
overridevirtual |
◆ startTestSuite()
| void robottestingframework::ConsoleListener::startTestSuite |
( |
const Test * |
test | ) |
|
|
overridevirtual |
◆ hideUncritical
| bool robottestingframework::ConsoleListener::hideUncritical |
|
private |
◆ verbose
| bool robottestingframework::ConsoleListener::verbose |
|
private |
The documentation for this class was generated from the following file: