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>
{
public:
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)
{
MyTest atest;
atest.TestCase::run(result);
}
#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.
class ConsoleListener listens to any messages reported by the tests during the test run,...
The base class to implememnt a test case.
The TestResultCollector class can be used to store all the events issued by the test cases,...
unsigned int failedCount()
failedCount gets the number of failed test cases.
The TestResult class is used to deliver the test results including any error and failures produced by...
void addListener(TestListener *listener)
Adding a new listener.
- Examples
- simple.cpp, simple_collector.cpp, simple_fixture.cpp, simple_runner.cpp, and simple_suite.cpp.
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: