RobotTestingFramework  2.0.1
Robot Testing Framework
TestResult.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_TESTRESULT_H
23 #define ROBOTTESTINGFRAMEWORK_TESTRESULT_H
24 
28 
29 #include <set>
30 
31 namespace robottestingframework {
32 
44 {
45  typedef std::set<TestListener*> ListenerContainer;
46  typedef std::set<TestListener*>::iterator ListenerIterator;
47 
48 public:
52  TestResult();
53 
57  virtual ~TestResult();
58 
63  void addListener(TestListener* listener);
64 
69  void removeListener(TestListener* listener);
70 
74  void reset();
75 
82  void addReport(const Test* test, TestMessage msg);
83 
89  void addError(const Test* test, TestMessage msg);
90 
96  void addFailure(const Test* test, TestMessage msg);
97 
102  void startTest(const Test* test);
103 
108  void endTest(const Test* test);
109 
114  void startTestSuite(const Test* test);
115 
120  void endTestSuite(const Test* test);
121 
125  void startTestRunner();
126 
130  void endTestRunner();
131 
132 private:
133  ListenerContainer listeners;
134 };
135 
136 } // namespace robottestingframework
137 
138 #endif // ROBOTTESTINGFRAMEWORK_TESTResult_H
void startTestSuite(const Test *test)
This is called when a TestSuite is started.
std::set< TestListener * >::iterator ListenerIterator
Definition: TestResult.h:46
void startTestRunner()
This is called when the TestRunner is started.
void removeListener(TestListener *listener)
Remove a listener.
void endTestRunner()
This is called when the TestRunner is finished.
The TestResult class is used to deliver the test results including any error and failures produced by...
Definition: TestResult.h:43
void endTest(const Test *test)
This is called when a Test is finished.
TestResult()
TestResult constructor.
The simplest form of a test unit.
Definition: Test.h:34
void endTestSuite(const Test *test)
This is called when a TestSuite is finished.
void addFailure(const Test *test, TestMessage msg)
This is called when a failure occurred during test run.
virtual ~TestResult()
TestResult destructor.
A formated message with details.
Definition: TestMessage.h:32
void addListener(TestListener *listener)
Adding a new listener.
std::set< TestListener * > ListenerContainer
Definition: TestResult.h:45
void startTest(const Test *test)
This is called when a Test is started.
The base class of any test result listeners.
Definition: TestListener.h:33
void reset()
Clear the listener list.
void addError(const Test *test, TestMessage msg)
This is called when an error occurred during test run.
void addReport(const Test *test, TestMessage msg)
This is called to report any arbitrary message from tests.