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 
97  void addFixtureManager(FixtureManager* manager);
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;
160  FixtureContainer fixtureManagers;
161  TestContainer tests;
162 };
163 
164 } // namespace robottestingframework
165 
166 #endif // ROBOTTESTINGFRAMEWORK_TESTSUITE_H
FixtureContainer fixtureManagers
Definition: TestSuite.h:160
std::size_t size() const
returns the number of tests in this suite
std::vector< FixtureManager * > FixtureContainer
Definition: TestSuite.h:59
std::vector< FixtureManager * >::iterator FixtureIterator
Definition: TestSuite.h:60
bool succeeded() const override
succeeded
void reset()
Clear the test list.
The TestResult class is used to deliver the test results including any error and failures produced by...
Definition: TestResult.h:43
TestResult * getResult()
getResult returns an instance of TestResult if run(TestResult &result) has been already called by a T...
void addFixtureManager(FixtureManager *manager)
addFixtureManager add a fixture manager for the current test suite.
void interrupt() override
interrupt interrupts the current test run
virtual void tearDown()
tearDown is called after the test run
The simplest form of a test unit.
Definition: Test.h:34
TestSuite(std::string name)
TestSuite constructor.
std::vector< Test * >::iterator TestIterator
Definition: TestSuite.h:58
A formated message with details.
Definition: TestMessage.h:32
virtual ~TestSuite()
TestSuite destructor.
void removeTest(Test *test)
Remove a test.
std::vector< Test * > TestContainer
Definition: TestSuite.h:57
void addTest(Test *test)
Adding a new test.
void run(TestResult &rsl) override
the main caller of a TestSuite inherited from Test Class.
std::vector< FixtureManager * >::reverse_iterator FixtureRIterator
Definition: TestSuite.h:61
virtual bool setup()
setup is called before the test run
The FixtureManager can be used to to setup any fixture which is required for the tests before executi...
void fixtureCollapsed(TestMessage reason) override
fixtureCollapsed is called by a fixture manager (if it is already setup) to inform the test suite tha...
The TestSuite holds a group of tests.
Definition: TestSuite.h:52