RobotTestingFramework  2.0.1
Robot Testing Framework
TestCase.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_TESTCASE_H
23 #define ROBOTTESTINGFRAMEWORK_TESTCASE_H
24 
27 
28 namespace robottestingframework {
29 
41 class TestCase : public Test
42 {
43 public:
49  TestCase(std::string name, std::string param = "");
50 
54  virtual ~TestCase();
55 
63  virtual bool setup(int argc, char** argv);
64 
68  virtual void tearDown();
69 
74  virtual void run() = 0;
75 
79  void interrupt() override;
80 
86  void run(TestResult& rsl) override;
87 
93  bool succeeded() const override;
94 
99  void failed();
100 
108 
115  void setParam(const std::string param);
116 
122  std::string getParam();
123 
124 
133  void setEnvironment(const std::string environment);
134 
140  std::string getEnvironment();
141 
148  void setRepetition(unsigned int rep);
149 
154  unsigned int getRepetition();
155 
156 private:
157  std::string param;
158  std::string environment;
162  unsigned int repetition;
163 };
164 
165 } // namespace robottestingframework
166 
167 #endif // ROBOTTESTINGFRAMEWORK_TESTCASE_H
std::string getEnvironment()
getParam gets the environment string which is set for the test case
bool succeeded() const override
succeeded
TestResult * getResult()
getResult Returns an instance of TestResult if run(TestResult &result) has been already called by a T...
std::string getParam()
getParam gets the original paramter string which is set for the test case
void interrupt() override
interrupt interrupts the current test run
The TestResult class is used to deliver the test results including any error and failures produced by...
Definition: TestResult.h:43
void setRepetition(unsigned int rep)
setRepetition sets the run repetition by default the run() method is called only once; The number of ...
The simplest form of a test unit.
Definition: Test.h:34
virtual bool setup(int argc, char **argv)
setup is called before the test run.
The base class to implememnt a test case.
Definition: TestCase.h:41
virtual ~TestCase()
TestCase destructor.
void failed()
failed Sets the test successful flag to false which indicates that the test was not successful...
virtual void run()=0
run is called by the TestCase class if setup is successfull;
virtual void tearDown()
tearDown is called after the test run
TestCase(std::string name, std::string param="")
TestCase constructor.
void setParam(const std::string param)
setParam Sets the optional parameters of the test.
unsigned int getRepetition()
getRepetition gets the tun repetition
void setEnvironment(const std::string environment)
setEnvironment Optioanlly specifies the environment in which the test case is executed.