TestCase.h
Go to the documentation of this file.
/*
* Robot Testing Framework
*
* Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef ROBOTTESTINGFRAMEWORK_TESTCASE_H
#define ROBOTTESTINGFRAMEWORK_TESTCASE_H
#include <robottestingframework/Test.h>
#include <robottestingframework/TestResult.h>
namespace robottestingframework {
class TestCase : public Test
{
public:
TestCase(std::string name, std::string param = "");
virtual ~TestCase();
virtual bool setup(int argc, char** argv);
virtual void tearDown();
virtual void run() = 0;
void interrupt() override;
void run(TestResult& rsl) override;
bool succeeded() const override;
void failed();
TestResult* getResult();
void setParam(const std::string param);
std::string getParam();
void setEnvironment(const std::string environment);
std::string getEnvironment();
void setRepetition(unsigned int rep);
unsigned int getRepetition();
private:
std::string param;
std::string environment;
TestResult* result;
bool successful;
bool interrupted;
unsigned int repetition;
};
} // namespace robottestingframework
#endif // ROBOTTESTINGFRAMEWORK_TESTCASE_H
TestResult.h
Test.h
robottestingframework::TestCase
The base class to implememnt a test case.
Definition: TestCase.h:42
robottestingframework::TestCase::run
void run(TestResult &rsl) override
the main caller of a TestCase inherited from Test Class.
robottestingframework::TestCase::interrupted
bool interrupted
Definition: TestCase.h:161
robottestingframework::TestCase::tearDown
virtual void tearDown()
tearDown is called after the test run
robottestingframework::TestCase::successful
bool successful
Definition: TestCase.h:160
robottestingframework::TestCase::interrupt
void interrupt() override
interrupt interrupts the current test run
robottestingframework::TestCase::repetition
unsigned int repetition
Definition: TestCase.h:162
robottestingframework::TestCase::setEnvironment
void setEnvironment(const std::string environment)
setEnvironment Optioanlly specifies the environment in which the test case is executed.
robottestingframework::TestCase::setParam
void setParam(const std::string param)
setParam Sets the optional parameters of the test.
robottestingframework::TestCase::~TestCase
virtual ~TestCase()
TestCase destructor.
robottestingframework::TestCase::getParam
std::string getParam()
getParam gets the original paramter string which is set for the test case
robottestingframework::TestCase::environment
std::string environment
Definition: TestCase.h:158
robottestingframework::TestCase::getEnvironment
std::string getEnvironment()
getParam gets the environment string which is set for the test case
robottestingframework::TestCase::succeeded
bool succeeded() const override
succeeded
robottestingframework::TestCase::TestCase
TestCase(std::string name, std::string param="")
TestCase constructor.
robottestingframework::TestCase::run
virtual void run()=0
run is called by the TestCase class if setup is successfull;
robottestingframework::TestCase::getResult
TestResult * getResult()
getResult Returns an instance of TestResult if run(TestResult &result) has been already called by a T...
robottestingframework::TestCase::result
TestResult * result
Definition: TestCase.h:159
robottestingframework::TestCase::failed
void failed()
failed Sets the test successful flag to false which indicates that the test was not successful.
robottestingframework::TestCase::setRepetition
void setRepetition(unsigned int rep)
setRepetition sets the run repetition by default the run() method is called only once; The number of ...
robottestingframework::TestCase::getRepetition
unsigned int getRepetition()
getRepetition gets the tun repetition
robottestingframework::TestCase::setup
virtual bool setup(int argc, char **argv)
setup is called before the test run.
robottestingframework::TestCase::param
std::string param
Definition: TestCase.h:157
robottestingframework::TestResult
The TestResult class is used to deliver the test results including any error and failures produced by...
Definition: TestResult.h:44
robottestingframework::Test
The simplest form of a test unit.
Definition: Test.h:35
robottestingframework
Definition: Arguments.h:25