RubyPluginLoader_impl.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_RUBYPLUGINLOADER_IMPL_H
#define ROBOTTESTINGFRAMEWORK_RUBYPLUGINLOADER_IMPL_H
#include <robottestingframework/TestCase.h>
#include <ruby.h>
#include <string>
namespace robottestingframework {
namespace plugin {
class RubyPluginLoaderImpl : public robottestingframework::TestCase
{
public:
RubyPluginLoaderImpl();
~RubyPluginLoaderImpl() override;
TestCase* open(const std::string filename);
void close();
std::string getLastError();
std::string getFileName();
void setTestName(const std::string name);
bool setup(int argc, char** argv) override;
void tearDown() override;
void run() override;
private:
std::string extractFileName(const std::string& path);
static RubyPluginLoaderImpl* getImpFromRuby();
static std::string getRubyErrorMessage();
static std::string getRubyBackTrace();
static VALUE wrapSetup(VALUE args);
static VALUE protectedSetup(VALUE testcase, ID id, VALUE param, RubyPluginLoaderImpl* impl);
static VALUE wrapRun(VALUE args);
static VALUE protectedRun(VALUE testcase, ID id, RubyPluginLoaderImpl* impl);
static VALUE wrapTearDown(VALUE args);
static VALUE protectedTearDown(VALUE testcase, ID id, RubyPluginLoaderImpl* impl);
static VALUE setName(VALUE self, VALUE obj);
static VALUE assertError(VALUE self, VALUE obj);
static VALUE assertFail(VALUE self, VALUE obj);
static VALUE testReport(VALUE self, VALUE obj);
static VALUE testCheck(VALUE self, VALUE cond, VALUE message);
private:
std::string filename;
std::string error;
VALUE testcase;
VALUE RobotTestingFrameworkModule;
};
} // namespace plugin
} // namespace robottestingframework
#endif // ROBOTTESTINGFRAMEWORK_RUBYPLUGINLOADER_IMPL_H
TestCase.h
robottestingframework::TestCase
The base class to implememnt a test case.
Definition: TestCase.h:42
robottestingframework::TestCase::param
std::string param
Definition: TestCase.h:157
robottestingframework::plugin::RubyPluginLoaderImpl
The RubyPluginLoaderImpl loads a ruby test case plug-in and gives the direct access to the TestCase.
Definition: RubyPluginLoader_impl.h:38
robottestingframework::plugin::RubyPluginLoaderImpl::getLastError
std::string getLastError()
getLastError gets the last error if any.
robottestingframework::plugin::RubyPluginLoaderImpl::testReport
static VALUE testReport(VALUE self, VALUE obj)
robottestingframework::plugin::RubyPluginLoaderImpl::setName
static VALUE setName(VALUE self, VALUE obj)
robottestingframework::plugin::RubyPluginLoaderImpl::setup
bool setup(int argc, char **argv) override
setup is called before the test run.
robottestingframework::plugin::RubyPluginLoaderImpl::getImpFromRuby
static RubyPluginLoaderImpl * getImpFromRuby()
robottestingframework::plugin::RubyPluginLoaderImpl::setTestName
void setTestName(const std::string name)
setTestName set the test case name
robottestingframework::plugin::RubyPluginLoaderImpl::assertFail
static VALUE assertFail(VALUE self, VALUE obj)
robottestingframework::plugin::RubyPluginLoaderImpl::wrapRun
static VALUE wrapRun(VALUE args)
robottestingframework::plugin::RubyPluginLoaderImpl::extractFileName
std::string extractFileName(const std::string &path)
robottestingframework::plugin::RubyPluginLoaderImpl::run
void run() override
run is called by the TestCase class if setup is successfull;
robottestingframework::plugin::RubyPluginLoaderImpl::wrapSetup
static VALUE wrapSetup(VALUE args)
robottestingframework::plugin::RubyPluginLoaderImpl::testCheck
static VALUE testCheck(VALUE self, VALUE cond, VALUE message)
robottestingframework::plugin::RubyPluginLoaderImpl::filename
std::string filename
Definition: RubyPluginLoader_impl.h:111
robottestingframework::plugin::RubyPluginLoaderImpl::testcase
VALUE testcase
Definition: RubyPluginLoader_impl.h:113
robottestingframework::plugin::RubyPluginLoaderImpl::tearDown
void tearDown() override
tearDown is called after the test run
robottestingframework::plugin::RubyPluginLoaderImpl::RubyPluginLoaderImpl
RubyPluginLoaderImpl()
RubyPluginLoaderImpl constructor.
robottestingframework::plugin::RubyPluginLoaderImpl::error
std::string error
Definition: RubyPluginLoader_impl.h:112
robottestingframework::plugin::RubyPluginLoaderImpl::wrapTearDown
static VALUE wrapTearDown(VALUE args)
robottestingframework::plugin::RubyPluginLoaderImpl::getRubyBackTrace
static std::string getRubyBackTrace()
robottestingframework::plugin::RubyPluginLoaderImpl::~RubyPluginLoaderImpl
~RubyPluginLoaderImpl() override
RubyPluginLoaderImpl destructor.
robottestingframework::plugin::RubyPluginLoaderImpl::getRubyErrorMessage
static std::string getRubyErrorMessage()
robottestingframework::plugin::RubyPluginLoaderImpl::close
void close()
close Unloads the plugin and deletes any allocated memory.
robottestingframework::plugin::RubyPluginLoaderImpl::assertError
static VALUE assertError(VALUE self, VALUE obj)
robottestingframework::plugin::RubyPluginLoaderImpl::protectedTearDown
static VALUE protectedTearDown(VALUE testcase, ID id, RubyPluginLoaderImpl *impl)
robottestingframework::plugin::RubyPluginLoaderImpl::RobotTestingFrameworkModule
VALUE RobotTestingFrameworkModule
Definition: RubyPluginLoader_impl.h:114
robottestingframework::plugin::RubyPluginLoaderImpl::protectedRun
static VALUE protectedRun(VALUE testcase, ID id, RubyPluginLoaderImpl *impl)
robottestingframework::plugin::RubyPluginLoaderImpl::open
TestCase * open(const std::string filename)
open Loads a test case plugin
robottestingframework::plugin::RubyPluginLoaderImpl::protectedSetup
static VALUE protectedSetup(VALUE testcase, ID id, VALUE param, RubyPluginLoaderImpl *impl)
robottestingframework::plugin::RubyPluginLoaderImpl::getFileName
std::string getFileName()
getFileName returns the loaded script file name
robottestingframework
Definition: Arguments.h:25