RobotTestingFramework  2.0.1
Robot Testing Framework
TestResultCollector.h
Go to the documentation of this file.
1 /*
2  * Robot Testing Framework
3  *
4  * Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT)
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 
22 #ifndef ROBOTTESTINGFRAMEWORK_TESTRESULTCOLLECTOR_H
23 #define ROBOTTESTINGFRAMEWORK_TESTRESULTCOLLECTOR_H
24 
27 
28 #include <vector>
29 
30 namespace robottestingframework {
31 
44 {
45 public:
46  typedef std::vector<ResultEvent*> EventResultContainer;
47  typedef std::vector<ResultEvent*>::iterator EventResultIterator;
48 
49 public:
54 
59 
63  void reset();
64 
70  unsigned int testCount();
71 
77  unsigned int failedCount();
78 
84  unsigned int passedCount();
85 
90  unsigned int suiteCount();
91 
96  unsigned int failedSuiteCount();
97 
102  unsigned int passedSuiteCount();
103 
113 
120  void addReport(const Test* test, TestMessage msg) override;
121 
127  void addError(const Test* test, TestMessage msg) override;
128 
134  void addFailure(const Test* test, TestMessage msg) override;
135 
140  void startTest(const Test* test) override;
141 
146  void endTest(const Test* test) override;
147 
152  void startTestSuite(const Test* test) override;
153 
158  void endTestSuite(const Test* test) override;
159 
160 private:
162  unsigned int nTests;
163  unsigned int nFailures;
164  unsigned int nPasses;
165  unsigned int nTestSuites;
166  unsigned int nSuiteFailures;
167  unsigned int nSuitePasses;
168 };
169 
170 } // namespace robottestingframework
171 
172 #endif // ROBOTTESTINGFRAMEWORK_TESTRESULTCOLLECTOR_H
The base class of any test result listeners.
Definition: TestListener.h:34
A formated message with details.
Definition: TestMessage.h:33
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.
std::vector< ResultEvent * >::iterator EventResultIterator
void addFailure(const Test *test, TestMessage msg) override
This is called when a failure occurred during test run.
void startTestSuite(const Test *test) override
This is called when a TestSuite is started.
void endTestSuite(const Test *test) override
This is called when a TestSuite is finished.
unsigned int failedSuiteCount()
failedCount gets the number of failed test suites.
void addError(const Test *test, TestMessage msg) override
This is called when an error occurred during test run.
unsigned int passedSuiteCount()
passedCount gets the number of passed test suites.
EventResultContainer & getResults()
getResults return any result event caught by the TestResultCollector.
std::vector< ResultEvent * > EventResultContainer
void startTest(const Test *test) override
This is called when a Test is started.
unsigned int suiteCount()
suiteCount gets the number of test suites.
void addReport(const Test *test, TestMessage msg) override
This is called to report any arbitrary message from tests.
unsigned int testCount()
testCount gets the number of test cases.
unsigned int passedCount()
passedCount gets the number of passed test cases.
void endTest(const Test *test) override
This is called when a Test is finished.
~TestResultCollector() override
TestResultCollector destructor.
TestResultCollector()
TestResultCollector constructor.
void reset()
reset clear the results
The simplest form of a test unit.
Definition: Test.h:35