Loading...
Searching...
No Matches
TestResultCollector.h
Go to the documentation of this file.
/*
* Robot Testing Framework
*
* Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef ROBOTTESTINGFRAMEWORK_TESTRESULTCOLLECTOR_H
#define ROBOTTESTINGFRAMEWORK_TESTRESULTCOLLECTOR_H
#include <robottestingframework/ResultEvent.h>
#include <robottestingframework/TestListener.h>
#include <vector>
namespace robottestingframework {
class TestResultCollector : public TestListener
{
public:
typedef std::vector<ResultEvent*> EventResultContainer;
typedef std::vector<ResultEvent*>::iterator EventResultIterator;
public:
TestResultCollector();
~TestResultCollector() override;
void reset();
unsigned int testCount();
unsigned int failedCount();
unsigned int passedCount();
unsigned int suiteCount();
unsigned int failedSuiteCount();
unsigned int passedSuiteCount();
EventResultContainer& getResults();
void addReport(const Test* test, TestMessage msg) override;
void addError(const Test* test, TestMessage msg) override;
void addFailure(const Test* test, TestMessage msg) override;
void startTest(const Test* test) override;
void endTest(const Test* test) override;
void startTestSuite(const Test* test) override;
void endTestSuite(const Test* test) override;
private:
EventResultContainer events;
unsigned int nTests;
unsigned int nFailures;
unsigned int nPasses;
unsigned int nTestSuites;
unsigned int nSuiteFailures;
unsigned int nSuitePasses;
};
} // namespace robottestingframework
#endif // ROBOTTESTINGFRAMEWORK_TESTRESULTCOLLECTOR_H
ResultEvent.h
TestListener.h
robottestingframework::TestListener
The base class of any test result listeners.
Definition TestListener.h:34
robottestingframework::TestMessage
A formated message with details.
Definition TestMessage.h:33
robottestingframework::TestResultCollector
The TestResultCollector class can be used to store all the events issued by the test cases,...
Definition TestResultCollector.h:44
robottestingframework::TestResultCollector::failedCount
unsigned int failedCount()
failedCount gets the number of failed test cases.
robottestingframework::TestResultCollector::EventResultIterator
std::vector< ResultEvent * >::iterator EventResultIterator
Definition TestResultCollector.h:47
robottestingframework::TestResultCollector::addFailure
void addFailure(const Test *test, TestMessage msg) override
This is called when a failure occurred during test run.
robottestingframework::TestResultCollector::getResults
EventResultContainer & getResults()
getResults return any result event caught by the TestResultCollector.
robottestingframework::TestResultCollector::startTestSuite
void startTestSuite(const Test *test) override
This is called when a TestSuite is started.
robottestingframework::TestResultCollector::endTestSuite
void endTestSuite(const Test *test) override
This is called when a TestSuite is finished.
robottestingframework::TestResultCollector::nTestSuites
unsigned int nTestSuites
Definition TestResultCollector.h:165
robottestingframework::TestResultCollector::failedSuiteCount
unsigned int failedSuiteCount()
failedCount gets the number of failed test suites.
robottestingframework::TestResultCollector::nSuitePasses
unsigned int nSuitePasses
Definition TestResultCollector.h:167
robottestingframework::TestResultCollector::addError
void addError(const Test *test, TestMessage msg) override
This is called when an error occurred during test run.
robottestingframework::TestResultCollector::passedSuiteCount
unsigned int passedSuiteCount()
passedCount gets the number of passed test suites.
robottestingframework::TestResultCollector::nPasses
unsigned int nPasses
Definition TestResultCollector.h:164
robottestingframework::TestResultCollector::events
EventResultContainer events
Definition TestResultCollector.h:161
robottestingframework::TestResultCollector::EventResultContainer
std::vector< ResultEvent * > EventResultContainer
Definition TestResultCollector.h:46
robottestingframework::TestResultCollector::startTest
void startTest(const Test *test) override
This is called when a Test is started.
robottestingframework::TestResultCollector::suiteCount
unsigned int suiteCount()
suiteCount gets the number of test suites.
robottestingframework::TestResultCollector::nTests
unsigned int nTests
Definition TestResultCollector.h:162
robottestingframework::TestResultCollector::nSuiteFailures
unsigned int nSuiteFailures
Definition TestResultCollector.h:166
robottestingframework::TestResultCollector::addReport
void addReport(const Test *test, TestMessage msg) override
This is called to report any arbitrary message from tests.
robottestingframework::TestResultCollector::testCount
unsigned int testCount()
testCount gets the number of test cases.
robottestingframework::TestResultCollector::nFailures
unsigned int nFailures
Definition TestResultCollector.h:163
robottestingframework::TestResultCollector::passedCount
unsigned int passedCount()
passedCount gets the number of passed test cases.
robottestingframework::TestResultCollector::endTest
void endTest(const Test *test) override
This is called when a Test is finished.
robottestingframework::TestResultCollector::~TestResultCollector
~TestResultCollector() override
TestResultCollector destructor.
robottestingframework::TestResultCollector::TestResultCollector
TestResultCollector()
TestResultCollector constructor.
robottestingframework::TestResultCollector::reset
void reset()
reset clear the results
robottestingframework::Test
The simplest form of a test unit.
Definition Test.h:35
robottestingframework
Definition Arguments.h:25