RobotTestingFramework  2.0.1
Robot Testing Framework
Test.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_TEST_H
23 #define ROBOTTESTINGFRAMEWORK_TEST_H
24 
25 #include <string>
26 
27 namespace robottestingframework {
28 
29 class TestResult;
30 
34 class Test
35 {
36 public:
43  Test(std::string name,
44  std::string description = "") :
45  strName(name),
46  strDescription(description)
47  {
48  }
49 
53  virtual ~Test()
54  {
55  }
56 
61  const std::string getName() const
62  {
63  return strName;
64  }
65 
70  const std::string getDescription() const
71  {
72  return strDescription;
73  }
74 
80  void setDescription(const std::string description)
81  {
82  strDescription = description;
83  }
84 
90  virtual void run(TestResult& result) = 0;
91 
95  virtual void interrupt()
96  {
97  }
98 
104  virtual bool succeeded() const = 0;
105 
106 protected:
111  void setName(std::string name)
112  {
113  strName = name;
114  }
115 
116 private:
117  std::string strName;
118  std::string strDescription;
119 };
120 
121 } // namespace robottestingframework
122 
123 #endif // ROBOTTESTINGFRAMEWORK_TEST_H
virtual bool succeeded() const =0
succeeded
void setName(std::string name)
setName setting the test name
Definition: Test.h:111
virtual ~Test()
Test destructor.
Definition: Test.h:53
std::string strName
Definition: Test.h:117
The TestResult class is used to deliver the test results including any error and failures produced by...
Definition: TestResult.h:43
std::string strDescription
Definition: Test.h:118
The simplest form of a test unit.
Definition: Test.h:34
virtual void run(TestResult &result)=0
the main caller of a test.
void setDescription(const std::string description)
setDescription Sets an optional string which describes the test.
Definition: Test.h:80
Test(std::string name, std::string description="")
Test constructor.
Definition: Test.h:43
virtual void interrupt()
interrupt interrupts the current test run
Definition: Test.h:95
const std::string getName() const
getName Getting test name.
Definition: Test.h:61
const std::string getDescription() const
getDescription Getting test description
Definition: Test.h:70