The TestResultCollector class can be used to store all the events issued by the test cases, suites and runner during the test run.
More...
#include <robottestingframework/TestResultCollector.h>
The TestResultCollector class can be used to store all the events issued by the test cases, suites and runner during the test run.
The collected events later can be used by a proper result formatter to be exported as HTML, XML or other desired formats.
Here's an example of using a TestResultCollector:
#include <cstdio>
{
public:
MyTest1() :
{
}
void run() override
{
}
};
{
public:
MyTest2() :
{
}
void run() override
{
}
};
int main(int argc, char** argv)
{
MyTest1 test1;
MyTest2 test2;
suite.addTest(&test1);
suite.addTest(&test2);
printf("\n-------- results ---------\n");
printf(
"Total number of tests : %d\n", collector.
testCount());
printf(
"Number of passed tests: %d\n", collector.
passedCount());
printf(
"Number of failed tests: %d\n", collector.
failedCount());
outputter.write("./result.txt", true);
}
- Examples:
- simple.cpp, simple_collector.cpp, simple_fixture.cpp, simple_runner.cpp, simple_suite.cpp, and simple_web.cpp.
Definition at line 43 of file TestResultCollector.h.
◆ EventResultContainer
◆ EventResultIterator
◆ TestResultCollector()
robottestingframework::TestResultCollector::TestResultCollector |
( |
| ) |
|
◆ ~TestResultCollector()
robottestingframework::TestResultCollector::~TestResultCollector |
( |
| ) |
|
|
override |
◆ addError()
void robottestingframework::TestResultCollector::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::TestResultCollector::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::TestResultCollector::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::TestResultCollector::endTest |
( |
const Test * |
test | ) |
|
|
overridevirtual |
◆ endTestSuite()
void robottestingframework::TestResultCollector::endTestSuite |
( |
const Test * |
test | ) |
|
|
overridevirtual |
◆ failedCount()
unsigned int robottestingframework::TestResultCollector::failedCount |
( |
| ) |
|
◆ failedSuiteCount()
unsigned int robottestingframework::TestResultCollector::failedSuiteCount |
( |
| ) |
|
failedCount gets the number of failed test suites.
- Returns
- the number of failed test suites.
◆ getResults()
◆ passedCount()
unsigned int robottestingframework::TestResultCollector::passedCount |
( |
| ) |
|
passedCount gets the number of passed test cases.
The test suites are not counted.
- Returns
- the number of passed tests.
- Examples:
- simple_collector.cpp.
◆ passedSuiteCount()
unsigned int robottestingframework::TestResultCollector::passedSuiteCount |
( |
| ) |
|
passedCount gets the number of passed test suites.
- Returns
- the number of passed test suites.
◆ reset()
void robottestingframework::TestResultCollector::reset |
( |
| ) |
|
◆ startTest()
void robottestingframework::TestResultCollector::startTest |
( |
const Test * |
test | ) |
|
|
overridevirtual |
◆ startTestSuite()
void robottestingframework::TestResultCollector::startTestSuite |
( |
const Test * |
test | ) |
|
|
overridevirtual |
◆ suiteCount()
unsigned int robottestingframework::TestResultCollector::suiteCount |
( |
| ) |
|
suiteCount gets the number of test suites.
- Returns
- the number of test suites
◆ testCount()
unsigned int robottestingframework::TestResultCollector::testCount |
( |
| ) |
|
testCount gets the number of test cases.
The test suites are not counted.
- Returns
- the number of tests
- Examples:
- simple_collector.cpp.
◆ events
◆ nFailures
unsigned int robottestingframework::TestResultCollector::nFailures |
|
private |
◆ nPasses
unsigned int robottestingframework::TestResultCollector::nPasses |
|
private |
◆ nSuiteFailures
unsigned int robottestingframework::TestResultCollector::nSuiteFailures |
|
private |
◆ nSuitePasses
unsigned int robottestingframework::TestResultCollector::nSuitePasses |
|
private |
◆ nTests
unsigned int robottestingframework::TestResultCollector::nTests |
|
private |
◆ nTestSuites
unsigned int robottestingframework::TestResultCollector::nTestSuites |
|
private |
The documentation for this class was generated from the following file: