RobotTestingFramework  2.0.1
Robot Testing Framework
TestSuite.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_TESTSUITE_H
23 #define ROBOTTESTINGFRAMEWORK_TESTSUITE_H
24 
29 
30 #include <vector>
31 
32 namespace robottestingframework {
33 
52 class TestSuite :
53  public Test,
54  public FixtureEvents
55 {
56 
57  typedef std::vector<Test*> TestContainer;
58  typedef std::vector<Test*>::iterator TestIterator;
59  typedef std::vector<FixtureManager*> FixtureContainer;
60  typedef std::vector<FixtureManager*>::iterator FixtureIterator;
61  typedef std::vector<FixtureManager*>::reverse_iterator FixtureRIterator;
62 
63 public:
68  TestSuite(std::string name);
69 
73  virtual ~TestSuite();
74 
79  void addTest(Test* test);
80 
85  void removeTest(Test* test);
86 
90  void reset();
91 
98 
106  void fixtureCollapsed(TestMessage reason) override;
107 
113  void run(TestResult& rsl) override;
114 
118  void interrupt() override;
119 
125  bool succeeded() const override;
126 
134 
139  std::size_t size() const;
140 
141 protected:
146  virtual bool setup();
147 
151  virtual void tearDown();
152 
153 private:
157  bool fixtureOK;
162 };
163 
164 } // namespace robottestingframework
165 
166 #endif // ROBOTTESTINGFRAMEWORK_TESTSUITE_H
The FixtureManager can be used to to setup any fixture which is required for the tests before executi...
A formated message with details.
Definition: TestMessage.h:33
The TestResult class is used to deliver the test results including any error and failures produced by...
Definition: TestResult.h:44
The TestSuite holds a group of tests.
Definition: TestSuite.h:55
std::vector< FixtureManager * >::reverse_iterator FixtureRIterator
Definition: TestSuite.h:61
void removeTest(Test *test)
Remove a test.
std::vector< FixtureManager * > FixtureContainer
Definition: TestSuite.h:59
void run(TestResult &rsl) override
the main caller of a TestSuite inherited from Test Class.
virtual ~TestSuite()
TestSuite destructor.
bool succeeded() const override
succeeded
void reset()
Clear the test list.
void addTest(Test *test)
Adding a new test.
void fixtureCollapsed(TestMessage reason) override
fixtureCollapsed is called by a fixture manager (if it is already setup) to inform the test suite tha...
void addFixtureManager(FixtureManager *manager)
addFixtureManager add a fixture manager for the current test suite.
TestSuite(std::string name)
TestSuite constructor.
void interrupt() override
interrupt interrupts the current test run
FixtureContainer fixtureManagers
Definition: TestSuite.h:160
std::vector< Test * >::iterator TestIterator
Definition: TestSuite.h:58
virtual void tearDown()
tearDown is called after the test run
TestResult * getResult()
getResult returns an instance of TestResult if run(TestResult &result) has been already called by a T...
std::size_t size() const
returns the number of tests in this suite
virtual bool setup()
setup is called before the test run
std::vector< Test * > TestContainer
Definition: TestSuite.h:57
std::vector< FixtureManager * >::iterator FixtureIterator
Definition: TestSuite.h:60
The simplest form of a test unit.
Definition: Test.h:35