├── .appveyor.yml ├── .clang-format ├── .coveralls.yml ├── .github └── workflows │ └── gh-pages.yml ├── .gitignore ├── .mailmap ├── .travis.yml ├── CMakeLists.txt ├── LICENSE ├── README.md ├── RobotTestingFrameworkConfig.cmake.in ├── cmake ├── AddInstallRPATHSupport.cmake ├── AddUninstallTarget.cmake ├── CMakePackageConfigHelpers.cmake ├── CodeCoverage.cmake ├── ExtractVersion.cmake ├── FindTinyXML.cmake ├── InstallBasicPackageFiles.cmake ├── ReplaceImportedTargets.cmake ├── RobotTestingFrameworkDoc.cmake ├── RobotTestingFrameworkOptions.cmake ├── RobotTestingFrameworkTestHelpers.cmake ├── StandardFindModule.cmake ├── WriteBasicConfigVersionFile.cmake └── doxygen │ └── Doxyfile.part.template ├── doc ├── lua_plugin_example.dox ├── main.dox ├── plugin_example.dox ├── python_plugin_example.dox ├── release │ ├── v1_4_0.md │ ├── v1_4_1.md │ ├── v1_6_0.md │ ├── v2_0_0.md │ ├── v2_0_1.md │ └── v2_0_2.md ├── robottestingframework-testrunner.dox ├── robottestingframework.png ├── robottestingframework.svg ├── robottestingframework_arch.png ├── robottestingframework_examples.dox └── ruby_plugin_example.dox ├── examples ├── CMakeLists.txt ├── ada-plugin │ ├── README.md │ ├── mytest.gpr │ └── src │ │ ├── mytest.adb │ │ └── mytest.ads ├── fixture-plugin │ ├── CMakeLists.txt │ ├── MyFixManager.cpp │ ├── MyFixManager.h │ └── test.cpp ├── lua-plugin │ ├── CMakeLists.txt │ ├── mytest.lua │ └── run.cpp ├── plugin │ ├── CMakeLists.txt │ ├── MyTest.cpp │ ├── MyTest.h │ └── run.cpp ├── python-plugin │ ├── CMakeLists.txt │ ├── mytest.py │ └── run.cpp ├── ruby-plugin │ ├── CMakeLists.txt │ ├── mytest.rb │ └── run.cpp ├── simple.cpp ├── simple_collector.cpp ├── simple_fixture.cpp ├── simple_runner.cpp ├── simple_suite.cpp ├── simple_web.cpp └── testrunner │ └── mysuite.xml ├── extern ├── CMakeLists.txt ├── mongoose │ ├── CMakeLists.txt │ └── src │ │ ├── mongoose.c │ │ └── mongoose.h └── tinyxml │ ├── CMakeLists.txt │ └── src │ ├── changes.txt │ ├── readme.txt │ ├── tinystr.h │ ├── tinyxml.cpp │ ├── tinyxml.h │ ├── tinyxmlerror.cpp │ └── tinyxmlparser.cpp ├── src ├── CMakeLists.txt ├── plugins │ ├── CMakeLists.txt │ ├── ada │ │ ├── README.md │ │ ├── src_ada │ │ │ ├── robottestingframework-asserter.adb │ │ │ ├── robottestingframework-asserter.ads │ │ │ ├── robottestingframework-testcase.adb │ │ │ ├── robottestingframework-testcase.ads │ │ │ └── robottestingframework.ads │ │ └── src_cpp │ │ │ └── AdaTest.cpp │ ├── dll │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── robottestingframework │ │ │ │ └── dll │ │ │ │ ├── DllFixturePluginLoader.h │ │ │ │ ├── DllPluginLoader.h │ │ │ │ ├── Plugin.h │ │ │ │ ├── SharedLibrary.h │ │ │ │ ├── SharedLibraryClass.h │ │ │ │ ├── SharedLibraryClassApi.h │ │ │ │ ├── SharedLibraryClassFactory.h │ │ │ │ ├── SharedLibraryFactory.h │ │ │ │ ├── Vocab.h │ │ │ │ ├── impl │ │ │ │ └── DllPluginLoader_impl.h │ │ │ │ └── robottestingframework_dll_config.h │ │ └── src │ │ │ ├── DllFixturePluginLoader.cpp │ │ │ ├── DllPluginLoader.cpp │ │ │ ├── SharedLibrary.cpp │ │ │ └── SharedLibraryFactory.cpp │ ├── lua │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── robottestingframework │ │ │ │ └── lua │ │ │ │ ├── LuaPluginLoader.h │ │ │ │ └── impl │ │ │ │ └── LuaPluginLoader_impl.h │ │ └── src │ │ │ └── LuaPluginLoader.cpp │ ├── python │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── robottestingframework │ │ │ │ └── python │ │ │ │ ├── PythonPluginLoader.h │ │ │ │ └── impl │ │ │ │ └── PythonPluginLoader_impl.h │ │ └── src │ │ │ └── PythonPluginLoader.cpp │ └── ruby │ │ ├── CMakeLists.txt │ │ ├── include │ │ └── robottestingframework │ │ │ └── ruby │ │ │ ├── RubyPluginLoader.h │ │ │ └── impl │ │ │ └── RubyPluginLoader_impl.h │ │ └── src │ │ └── RubyPluginLoader.cpp ├── robottestingframework-testrunner │ ├── CMakeLists.txt │ ├── include │ │ ├── ErrorLogger.h │ │ ├── JUnitOutputter.h │ │ ├── PlatformDir.h │ │ ├── PluginFactory.h │ │ ├── PluginRunner.h │ │ ├── SuiteRunner.h │ │ ├── Version.h.in │ │ └── cmdline.h │ └── src │ │ ├── ErrorLogger.cpp │ │ ├── JUnitOutputter.cpp │ │ ├── PluginRunner.cpp │ │ ├── SuiteRunner.cpp │ │ └── main.cpp └── robottestingframework │ ├── CMakeLists.txt │ ├── include │ └── robottestingframework │ │ ├── Arguments.h │ │ ├── Asserter.h │ │ ├── ConsoleListener.h │ │ ├── Exception.h │ │ ├── FixtureManager.h │ │ ├── PluginLoader.h │ │ ├── ResultEvent.h │ │ ├── Test.h │ │ ├── TestAssert.h │ │ ├── TestCase.h │ │ ├── TestListener.h │ │ ├── TestMessage.h │ │ ├── TestResult.h │ │ ├── TestResultCollector.h │ │ ├── TestRunner.h │ │ ├── TestSuite.h │ │ ├── TextOutputter.h │ │ ├── WebProgressListener.h │ │ └── impl │ │ └── WebProgressListener_impl.h │ └── src │ ├── Arguments.cpp │ ├── Asserter.cpp │ ├── ConsoleListener.cpp │ ├── FixtureManager.cpp │ ├── TestCase.cpp │ ├── TestMessage.cpp │ ├── TestResult.cpp │ ├── TestResultCollector.cpp │ ├── TestRunner.cpp │ ├── TestSuite.cpp │ ├── TextOutputter.cpp │ └── WebProgressListener.cpp └── tests ├── CMakeLists.txt ├── api ├── AsserterTest.cpp ├── CMakeLists.txt ├── ExceptionsTest.cpp └── VocabTest.cpp ├── basic ├── CMakeLists.txt ├── FixtureManager.cpp ├── MultiTestCases.cpp ├── SingleTestCase.cpp ├── SingleTestSuite.cpp └── WebProgListener.cpp ├── fixture ├── CMakeLists.txt ├── FixturePluginLoader.cpp ├── MyFixManager.cpp └── MyFixManager.h ├── lua ├── CMakeLists.txt ├── LuaPlugin.cpp └── LuaTestCase.lua ├── misc ├── CMakeLists.txt ├── check_license.pl └── check_license_skip.txt ├── python ├── CMakeLists.txt ├── PythonPlugin.cpp └── PythonTestCase.py ├── robottestingframework-testrunner ├── CMakeLists.txt └── testsuite.xml ├── robottestingframework_add_suite ├── CMakeLists.txt └── demo │ ├── CMakeLists.txt │ ├── demo_fixturemanager.cpp │ └── demo_testcase.cpp └── ruby ├── CMakeLists.txt ├── RubyPlugin.cpp └── RubyTestCase.rb /.appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 2.0.0.{build} 2 | 3 | platform: 4 | - Win32 5 | - x64 6 | 7 | image: 8 | - Visual Studio 2015 9 | - Visual Studio 2017 10 | 11 | configuration: 12 | - Release 13 | - Debug 14 | 15 | environment: 16 | global: 17 | CTEST_OUTPUT_ON_FAILURE: 1 18 | 19 | matrix: 20 | - BUILD_SHARED_LIBS: ON 21 | - BUILD_SHARED_LIBS: OFF 22 | 23 | 24 | clone_folder: c:\dev\robot-testing-framework 25 | 26 | init: 27 | # System related variables 28 | - cmd: if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" set CMAKE_GENERATOR=Visual Studio 15 2017 29 | - cmd: if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" set CMAKE_GENERATOR=Visual Studio 14 2015 30 | - cmd: if "%platform%"=="x64" set CMAKE_GENERATOR=%CMAKE_GENERATOR% Win64 31 | - cmd: echo CMAKE_GENERATOR=%CMAKE_GENERATOR% 32 | 33 | build_script: 34 | - cd c:\dev\robot-testing-framework 35 | - md build 36 | - cd build 37 | - cmake -G"%CMAKE_GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% .. 38 | - msbuild /m /p:Configuration="%CONFIGURATION%" /p:Platform="%platform%" RobotTestingFramework.sln 39 | 40 | test_script: 41 | - cmd: ctest --output-on-failure --build-config %CONFIGURATION% 42 | -------------------------------------------------------------------------------- /.coveralls.yml: -------------------------------------------------------------------------------- 1 | repo_token: Gcfb0Rzm9kFpzrwyT5NiQQivi2oWvvjdm 2 | -------------------------------------------------------------------------------- /.github/workflows/gh-pages.yml: -------------------------------------------------------------------------------- 1 | name: GitHub Pages 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | - 'gh-pages-base' 8 | schedule: 9 | - cron: '0 2 * * *' 10 | 11 | jobs: 12 | docs: 13 | name: "Publish" 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - name: Checkout 18 | uses: actions/checkout@master 19 | 20 | - name: Dependencies 21 | run: | 22 | sudo apt update 23 | sudo apt install -y doxygen doxygen-doc texlive ghostscript graphviz plantuml cmake 24 | 25 | - name: Configure Git 26 | run: | 27 | git config --global push.default upstream 28 | git config --global user.name "GitHub Actions" 29 | git config --global user.email "actions@github.com" 30 | git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git 31 | 32 | - name: Build Doxygen documentation 33 | run: | 34 | mkdir build 35 | (cd build && cmake ..) 36 | (cd build && make dox) 37 | cp -a build/dox/html docs 38 | 39 | - name: Push gh-pages 40 | run: | 41 | git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin gh-pages-base 42 | git checkout --no-track -b gh-pages origin/gh-pages-base 43 | git add docs 44 | git commit -m "Generate gh-pages" 45 | git push --force origin gh-pages:gh-pages 46 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build* 2 | *.swp 3 | *.*~ 4 | CMakeLists.txt.user 5 | *.DS_Store 6 | CMakeCache.txt 7 | /CMakeFiles/ 8 | /Testing/ 9 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | Ali Paikan 2 | Claudio Fantacci 3 | Francesco Romano 4 | Lorenzo Natale 5 | Nicolò Genesio 6 | Silvio Traversaro 7 | Silvio Traversaro 8 | Robot Testing Framework Developers 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | dist: trusty 3 | 4 | language: cpp 5 | 6 | compiler: 7 | - gcc 8 | # - clang 9 | 10 | os: 11 | - linux 12 | - osx 13 | 14 | env: 15 | global: 16 | - CTEST_OUTPUT_ON_FAILURE=1 17 | matrix: 18 | - TRAVIS_BUILD_TYPE=Debug 19 | - TRAVIS_BUILD_TYPE=Release 20 | 21 | before_install: 22 | - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq; fi 23 | - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi 24 | - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew tap robotology/cask; fi 25 | - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew tap homebrew/core; fi 26 | install: 27 | - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew outdated cmake || brew upgrade cmake; fi 28 | - if [ "$TRAVIS_OS_NAME" == "osx" ]; then if ! brew ls --versions python > /dev/null; then brew install python; fi; fi 29 | - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install tinyxml lua51; fi 30 | - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -y cmake3 libtinyxml-dev liblua5.1-dev python-dev lcov; fi 31 | - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo gem install coveralls-lcov; fi 32 | 33 | before_script: 34 | - python --version 35 | - ruby --version 36 | 37 | script: 38 | # configure robot-testing-framework 39 | - mkdir build 40 | - cd build 41 | - if [ "$TRAVIS_OS_NAME" == "linux" ]; then cmake -DENABLE_CODE_PROFILING:BOOL=ON -DENABLE_LUA_PLUGIN:BOOL=ON -DENABLE_PYTHON_PLUGIN:BOOL=ON -DENABLE_WEB_LISTENER:BOOL=ON ..; fi 42 | - if [ "$TRAVIS_OS_NAME" == "osx" ]; then cmake -DCMAKE_BUILD_TYPE=${TRAVIS_BUILD_TYPE} -DENABLE_LUA_PLUGIN:BOOL=ON -DENABLE_PYTHON_PLUGIN:BOOL=ON -DENABLE_WEB_LISTENER:BOOL=ON ..; fi 43 | - make 44 | - ctest --output-on-failure --build . -C ${TRAVIS_BUILD_TYPE} 45 | - if [ "$TRAVIS_OS_NAME" == "linux" ]; then make coverage ; fi 46 | - sudo make install 47 | 48 | after_success: 49 | - coveralls-lcov --repo-token Gcfb0Rzm9kFpzrwyT5NiQQivi2oWvvjdm coverage.info.cleaned 50 | # - bash <(curl -s https://codecov.io/bash) 51 | 52 | notifications: 53 | email: 54 | - pegua1@gmail.com 55 | - ali.paikan@gmail.com 56 | -------------------------------------------------------------------------------- /cmake/FindTinyXML.cmake: -------------------------------------------------------------------------------- 1 | #.rst: 2 | # FindTinyXML 3 | # ----------- 4 | # 5 | # Try to find the TinyXML library. 6 | # Once done this will define the following variables:: 7 | # 8 | # TinyXML_FOUND - System has TinyXML 9 | # TinyXML_INCLUDE_DIRS - TinyXML include directory 10 | # TinyXML_LIBRARIES - TinyXML libraries 11 | # TinyXML_DEFINITIONS - Additional compiler flags for TinyXML 12 | # TinyXML_VERSION - TinyXML version 13 | # TinyXML_MAJOR_VERSION - TinyXML major version 14 | # TinyXML_MINOR_VERSION - TinyXML minor version 15 | # TinyXML_PATCH_VERSION - TinyXML patch version 16 | 17 | #============================================================================= 18 | # Copyright 2012-2013 Istituto Italiano di Tecnologia (IIT) 19 | # Authors: Daniele E. Domenichelli 20 | # 21 | # Distributed under the OSI-approved BSD License (the "License"); 22 | # see accompanying file Copyright.txt for details. 23 | # 24 | # This software is distributed WITHOUT ANY WARRANTY; without even the 25 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 26 | # See the License for more information. 27 | #============================================================================= 28 | # (To distribute this file outside of YCM, substitute the full 29 | # License text for the above reference.) 30 | 31 | 32 | include(StandardFindModule) 33 | standard_find_module(TinyXML tinyxml 34 | SKIP_CMAKE_CONFIG) 35 | 36 | # Set package properties if FeatureSummary was included 37 | if(COMMAND set_package_properties) 38 | set_package_properties(TinyXML PROPERTIES DESCRIPTION "A small, simple XML parser for the C++ language" 39 | URL "http://www.grinninglizard.com/tinyxml/index.html") 40 | endif() 41 | -------------------------------------------------------------------------------- /cmake/RobotTestingFrameworkDoc.cmake: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | find_package(Doxygen) 21 | 22 | if(DOXYGEN_FOUND) 23 | set(DOX_GENERATE_HTML YES) 24 | set(DOX_GENERATE_XML NO) 25 | set(DOX_GENERATE_TAGFILE "") 26 | option(RobotTestingFramework_DOXYGEN_XML "Generate doxygen XML output, for use by SWIG" NO) 27 | option(RobotTestingFramework_DOXYGEN_TAGFILE "Generate doxygen tag file, see http://www.doxygen.nl/manual/external.html" NO) 28 | mark_as_advanced(RobotTestingFramework_DOXYGEN_XML RobotTestingFramework_DOXYGEN_TAGFILE) 29 | if(RobotTestingFramework_DOXYGEN_XML) 30 | set(DOX_GENERATE_XML YES) 31 | endif() 32 | if(RobotTestingFramework_DOXYGEN_TAGFILE) 33 | set(DOX_GENERATE_TAGFILE "${CMAKE_BINARY_DIR}/dox/RobotTestingFramework.tag") 34 | endif() 35 | 36 | set(DOX_FILE Doxyfile.part) 37 | # RobotTestingFramework documentation is always verbose now. It used to be 38 | # partially stripped of stuff less interesting to end-users. 39 | set(DOX_PATTERNS "*.h *.dox *.cpp") 40 | set(DOX_GENERATE_MAN NO) 41 | configure_file(${CMAKE_CURRENT_LIST_DIR}/doxygen/${DOX_FILE}.template 42 | ${CMAKE_BINARY_DIR}/dox/${DOX_FILE}) 43 | add_custom_target(dox COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/dox/${DOX_FILE}) 44 | 45 | set(DOX_GENERATE_HTML NO) 46 | set(DOX_GENERATE_MAN YES) 47 | set(DOX_GENERATE_XML NO) 48 | set(DOX_GENERATE_TAGFILE "") 49 | set(DOX_PATTERNS "cmd_*.dox") 50 | configure_file(${CMAKE_CURRENT_LIST_DIR}/doxygen/${DOX_FILE}.template 51 | ${CMAKE_BINARY_DIR}/dox/${DOX_FILE}.man) 52 | add_custom_target(man COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/dox/${DOX_FILE}.man) 53 | endif(DOXYGEN_FOUND) 54 | -------------------------------------------------------------------------------- /cmake/WriteBasicConfigVersionFile.cmake: -------------------------------------------------------------------------------- 1 | # Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2 | # file Copyright.txt or https://cmake.org/licensing for details. 3 | 4 | #[=======================================================================[.rst: 5 | WriteBasicConfigVersionFile 6 | --------------------------- 7 | 8 | .. deprecated:: 3.0 9 | 10 | Use the identical command :command:`write_basic_package_version_file()` 11 | from module :module:`CMakePackageConfigHelpers`. 12 | 13 | :: 14 | 15 | WRITE_BASIC_CONFIG_VERSION_FILE( filename 16 | [VERSION major.minor.patch] 17 | COMPATIBILITY (AnyNewerVersion|SameMajorVersion|SameMinorVersion|ExactVersion) 18 | [ARCH_INDEPENDENT] 19 | ) 20 | 21 | 22 | #]=======================================================================] 23 | 24 | function(WRITE_BASIC_CONFIG_VERSION_FILE _filename) 25 | 26 | set(options ARCH_INDEPENDENT ) 27 | set(oneValueArgs VERSION COMPATIBILITY ) 28 | set(multiValueArgs ) 29 | 30 | cmake_parse_arguments(CVF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) 31 | 32 | if(CVF_UNPARSED_ARGUMENTS) 33 | message(FATAL_ERROR "Unknown keywords given to WRITE_BASIC_CONFIG_VERSION_FILE(): \"${CVF_UNPARSED_ARGUMENTS}\"") 34 | endif() 35 | 36 | set(versionTemplateFile "${CMAKE_ROOT}/Modules/BasicConfigVersion-${CVF_COMPATIBILITY}.cmake.in") 37 | if(NOT EXISTS "${versionTemplateFile}") 38 | message(FATAL_ERROR "Bad COMPATIBILITY value used for WRITE_BASIC_CONFIG_VERSION_FILE(): \"${CVF_COMPATIBILITY}\"") 39 | endif() 40 | 41 | if("${CVF_VERSION}" STREQUAL "") 42 | if ("${PROJECT_VERSION}" STREQUAL "") 43 | message(FATAL_ERROR "No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()") 44 | else() 45 | set(CVF_VERSION "${PROJECT_VERSION}") 46 | endif() 47 | endif() 48 | 49 | configure_file("${versionTemplateFile}" "${_filename}" @ONLY) 50 | 51 | endfunction() 52 | -------------------------------------------------------------------------------- /doc/release/v1_4_0.md: -------------------------------------------------------------------------------- 1 | Robot Testing Framework 1.4.0 (2018-02-09) Release Notes {#v1_4_0} 2 | ======================================================== 3 | 4 | Important Changes 5 | ----------------- 6 | 7 | * RTF now requires CMake 3.5 for building. 8 | * C++11 is required for compiling and using RTF. 9 | * Added `[[noreturn]]` c++11 statement for assert macros. 10 | * Fixed old typo, the keyword `suit` has been replaced with `suite`, maintaining 11 | the backward compatibility. 12 | * Added `target_include_directories` in all RTF libraries. 13 | * Change logic for `RTF_*_IF(condition, message)` functions, adding new 14 | functions `RTF_*_IF_TRUE` and `RTF_*_IF_FALSE`, deprecating the old ones. 15 | * It is now possible to pass an absolute path to a library. 16 | * The RTF libraries library can now be compiled either as shared or 17 | static libraries, using the [`BUILD_SHARED_LIBS`](https://cmake.org/cmake/help/v3.5/variable/BUILD_SHARED_LIBS.html) 18 | CMake variable. For RTF, we set the default value of `BUILD_SHARED_LIBS` to ON. 19 | Before this release, Windows compilation was only supported if RTF libraries were compiled 20 | as static libraries, while now also on Windows by default libraries are compiled as shared ( https://github.com/robotology/robot-testing-framework/pull/85 ). 21 | 22 | ### Libraries 23 | 24 | 25 | New Features 26 | ------------ 27 | 28 | ### CMake Modules 29 | 30 | * Added `rtf_add_plugin`. 31 | * Added `rtf_add_suite`. 32 | * Exported target `testrunner`. 33 | 34 | ### Libraries 35 | 36 | #### `RTF` 37 | 38 | * Added xml tag order check. 39 | * Added `RTF::TestSuite::size()` method 40 | 41 | ### Tools 42 | 43 | #### testrunner 44 | 45 | * The order of the dots in the status bar is now correct (#94) 46 | 47 | Bug Fixes 48 | --------- 49 | 50 | ### Libraries 51 | 52 | #### `RTF_dll` 53 | 54 | * Fixed dll postfix mismatch on windows. 55 | In debug configuration rtf will try to load the dll with a "d" between the 56 | name and the format (e.g. name + "d" + .dll) 57 | * `SharedLibrary*` classes unified with respective `YARP` code. 58 | In particular commit c114635 has been imported from YARP. 59 | See issue #435 in robotology/yarp for more details. 60 | 61 | Contributors 62 | ------------ 63 | 64 | This is a list of people that contributed to this release (generated from the 65 | git history using `git shortlog -ens --no-merges v1.2.0..v1.4.0`): 66 | 67 | ``` 68 | 28 Nicolo' Genesio 69 | 21 Daniele E. Domenichelli 70 | 11 Andrea Ruzzenenti 71 | 6 Damiano Enerli 72 | 5 Silvio Traversaro 73 | 1 Nicolò Genesio 74 | ``` 75 | -------------------------------------------------------------------------------- /doc/release/v1_4_1.md: -------------------------------------------------------------------------------- 1 | Robot Testing Framework 1.4.1 (2018-09-09) Release Notes {#v1_4_1} 2 | ======================================================== 3 | 4 | Bug Fixes 5 | --------- 6 | 7 | * Restore (but deprecated) backward compatibility with `rtf/TestSuit.h` header 8 | and with the `RTF::TestSuit` class ( https://github.com/robotology/robot-testing-framework/pull/97 ). 9 | -------------------------------------------------------------------------------- /doc/release/v1_6_0.md: -------------------------------------------------------------------------------- 1 | Robot Testing Framework 1.6.0 (2018-09-09) Release Notes {#v1_6_0} 2 | ======================================================== 3 | 4 | Important Changes 5 | ----------------- 6 | 7 | * Visual Studio 2013 is no longer supported, due to the use of constexpr in VOCAB4 macro ( https://github.com/robotology/robot-testing-framework/pull/98 ). 8 | 9 | -------------------------------------------------------------------------------- /doc/release/v2_0_0.md: -------------------------------------------------------------------------------- 1 | Robot Testing Framework 2.0.0 (2019-06-03) Release Notes {#v2_0_0} 2 | ======================================================== 3 | 4 | Important Changes 5 | ----------------- 6 | 7 | * The RTF acronym is no longer used to avoid conflicts with Rich Text Format. 8 | Therefore the following changes were applied: 9 | * The CMake package was changed from `RTF` to `RobotTestingFramework` 10 | (e.g. `find_package(RobotTestingFramework)`) 11 | * The CMake target namespace was changed from `RTF` to 12 | `RobotTestingFramework`. The names of the target are unchanged. 13 | (e.g. `target_link_libraries(foo PRIVATE RobotTestingFramework::RTF)` 14 | * The CMake variables were changed from `RTF` to `RobotTestingFramework` 15 | (e.g. `RobotTestingFramework_INCLUDE_DIRS`) 16 | * The CMake macros and functions were changed from `rtf` to 17 | `robottestingframework` 18 | (e.g. `robottestingframework_add_suite`) 19 | * The name of the libraries were changed from `RTF*` to 20 | `robottestingframework*` 21 | (e.g. `librobottestingframework.so`) 22 | * The `testrunner` executable was renamed `robottestingframework-testrunner` 23 | * The include path changed from `rtf` to `robottestingframework` 24 | (e.g. `#include `) 25 | * The namespace changed from `RTF` to `robottestingframework` 26 | (e.g. `robottestingframework::TestCase`) 27 | * The preprocessor macros `RTF_*` were renamed `ROBOTTESTINGFRAMEWORK_` 28 | (e.g. `ROBOTTESTINGFRAMEWORK_ASSERT_ERROR("This is an error")`) 29 | * The module name for script languages was changed from `RTF` to 30 | `robottestingframework` or `RobotTestingFramework` (language dependent) 31 | (e.g. `robottestingframework.setName("PythonTestCase")`, and 32 | `RobotTestingFramework::setName("RubyTestCase")`) 33 | * The `PREPARE_FIXTURE_PLUGIN` macro was renamed 34 | `ROBOTTESTINGFRAMEWORK_PREPARE_FIXTURE_PLUGIN` 35 | * The `PREPARE_PLUGIN` macro was renamed `ROBOTTESTINGFRAMEWORK_PREPARE_PLUGIN` 36 | * Support for `suit` instead of `suite` was removed. 37 | * The following methods return `std::string` instead of `const std::string` 38 | * `FixtureManager::getParam` 39 | * `PluginLoader::getLastError` 40 | * `TestCase::getParam` 41 | * `TestCase::getEnvironment` 42 | * `TestMessage::getMessage` 43 | * `TestMessage::getDetail` 44 | * `TestMessage::getSourceFileName` 45 | -------------------------------------------------------------------------------- /doc/release/v2_0_1.md: -------------------------------------------------------------------------------- 1 | Robot Testing Framework 2.0.1 (2020-05-08) Release Notes {#v2.0.1} 2 | ======================================================== 3 | 4 | Important Changes 5 | ----------------- 6 | 7 | * Fix compilation problem with vcpkg-provided TinyXML (https://github.com/robotology/robot-testing-framework/pull/108). 8 | -------------------------------------------------------------------------------- /doc/release/v2_0_2.md: -------------------------------------------------------------------------------- 1 | Robot Testing Framework 2.0.2 (UNRELEASED) Release Notes {#v2.0.2} 2 | ======================================================== 3 | 4 | Bug Fixes 5 | --------- 6 | 7 | * Fixed several spelling errors. 8 | * Fixed `RobotTestingFrameworkConfig.cmake` when 9 | `CMAKE_INSTALL_INCLUDEDIR` is not the default. 10 | -------------------------------------------------------------------------------- /doc/robottestingframework.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotology/robot-testing-framework/3726e898218430488fd795ea990ccf87df47feed/doc/robottestingframework.png -------------------------------------------------------------------------------- /doc/robottestingframework_arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotology/robot-testing-framework/3726e898218430488fd795ea990ccf87df47feed/doc/robottestingframework_arch.png -------------------------------------------------------------------------------- /doc/robottestingframework_examples.dox: -------------------------------------------------------------------------------- 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 | @page robottestingframework_examples Some examples 23 | 24 | There are many code examples available in the \c "examples" 25 | subdirectory of Robot Testing Framework. 26 | */ 27 | 28 | 29 | /** 30 | * \example simple.cpp 31 | 32 | This example shows a simple way of using TestCase, TestResult and ConsoleListener. 33 | 34 | */ 35 | 36 | /** 37 | * \example simple_suite.cpp 38 | 39 | This example shows how to use a TestSuite to run multiple test cases. 40 | 41 | */ 42 | 43 | /** 44 | * \example simple_runner.cpp 45 | 46 | This example shows how to use a TestRunner to run the tests. 47 | 48 | */ 49 | 50 | 51 | /** 52 | * \example simple_collector.cpp 53 | 54 | This example shows how to use a TestResultCollector to collect the result of the test run. 55 | 56 | */ 57 | 58 | 59 | /** 60 | * \example simple_fixture.cpp 61 | 62 | This example shows using a FixtureManager to setup any fixture required for a TestSuite. 63 | 64 | */ 65 | 66 | /** 67 | * \example simple_web.cpp 68 | 69 | This example shows how to use WebListener to report the results and monitor the tests from a web browser. 70 | 71 | */ 72 | 73 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | # Build examples 20 | if (BUILD_EXAMPLES) 21 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/examples") 22 | 23 | add_executable(robottestingframework_simple simple.cpp) 24 | target_link_libraries(robottestingframework_simple RobotTestingFramework::RTF) 25 | 26 | add_executable(robottestingframework_simple_suite simple_suite.cpp) 27 | target_link_libraries(robottestingframework_simple_suite RobotTestingFramework::RTF) 28 | 29 | add_executable(robottestingframework_simple_collector simple_collector.cpp) 30 | target_link_libraries(robottestingframework_simple_collector RobotTestingFramework::RTF) 31 | 32 | add_executable(robottestingframework_simple_runner simple_runner.cpp) 33 | target_link_libraries(robottestingframework_simple_runner RobotTestingFramework::RTF) 34 | 35 | add_executable(robottestingframework_simple_fixture simple_fixture.cpp) 36 | target_link_libraries(robottestingframework_simple_fixture RobotTestingFramework::RTF) 37 | 38 | if(ENABLE_WEB_LISTENER) 39 | add_executable(robottestingframework_simple_web simple_web.cpp) 40 | target_link_libraries(robottestingframework_simple_web RobotTestingFramework::RTF) 41 | endif() 42 | endif() 43 | -------------------------------------------------------------------------------- /examples/ada-plugin/README.md: -------------------------------------------------------------------------------- 1 | The example shows how to develop a test case using 2 | Ada programing language which can be executed using 3 | the Robot Testing Framework `robottestingframework-testrunner`. 4 | 5 | Compilation 6 | ----------- 7 | Build the project using gnat build system by specifying 8 | the Robot Testing Framework root directory in `RobotTestingFramework_ROOT`. 9 | For example: 10 | 11 | ``` 12 | $ mkdir build plugin 13 | $ gprbuild -P mytest.gpr -XRobotTestingFramework_ROOT=/home/foo/robot-testing 14 | ``` 15 | 16 | Alternatively you can set the `RobotTestingFramework_ROOT` environment variable 17 | to point to the RobotTestingFramework root directory; then build the plug-in: 18 | 19 | ``` 20 | $ mkdir build plugin 21 | $ gprbuild -P mytest.gpr 22 | ``` 23 | 24 | Running the test case 25 | --------------------- 26 | Simply use the `robottestingframework-testrunner` : 27 | 28 | ``` 29 | $ robottestingframework-testrunner -v -t plugin/libmytest.so 30 | ``` 31 | 32 | -------------------------------------------------------------------------------- /examples/ada-plugin/mytest.gpr: -------------------------------------------------------------------------------- 1 | -- Robot Testing Framework 2 | -- 3 | -- Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | -- 5 | -- This library is free software; you can redistribute it and/or 6 | -- modify it under the terms of the GNU Lesser General Public 7 | -- License as published by the Free Software Foundation; either 8 | -- version 2.1 of the License, or (at your option) any later version. 9 | -- 10 | -- This library is distributed in the hope that it will be useful, 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | -- Lesser General Public License for more details. 14 | -- 15 | -- You should have received a copy of the GNU Lesser General Public 16 | -- License along with this library; if not, write to the Free Software 17 | -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Project MyTest is 20 | 21 | RobotTestingFramework_SrcDir := external("RobotTestingFramework_ROOT"); 22 | 23 | ---------------- 24 | -- Attributes -- 25 | ---------------- 26 | -- set the library attributes 27 | for Library_Name use "mytest"; 28 | for Library_Interface use ("mytest"); 29 | for Library_Dir use "./plugin"; 30 | for Library_Kind use "dynamic"; 31 | for Object_Dir use "./build"; 32 | 33 | 34 | -- set the source files and language attributes 35 | for Languages use ("Ada", "C++"); 36 | for Source_Dirs use ("./src", 37 | RobotTestingFramework_SrcDir & "/src/plugins/ada/src_ada", 38 | RobotTestingFramework_SrcDir & "/src/plugins/ada/src_cpp"); 39 | 40 | -------------- 41 | -- Packages -- 42 | -------------- 43 | package Naming is 44 | for Specification_Suffix ("C++") use ".h"; 45 | for Implementation_Suffix ("C++") use ".cpp"; 46 | end Naming; 47 | 48 | package Compiler is 49 | -- This attributes contains the switches used by default for the Ada 50 | --for Default_Switches ("Ada") use ("-O2", "-gnat05", "-gnatwcfkmruv"); 51 | for Default_Switches ("Ada") use ("-O2", "-gnatwcfkmruv"); 52 | -- This attributes contains the switches used by default for the C++ 53 | for Default_Switches ("C++") use ("-O2", 54 | "-I" & RobotTestingFramework_SrcDIR & "/src/robottestingframework/include", 55 | "-I" & RobotTestingFramework_SrcDIR & "/src/plugins/dll/include"); 56 | end Compiler; 57 | 58 | package Binder is 59 | for Objects_Path ("Ada") use "ADA_OBJECTS_PATH"; 60 | for Objects_Path_File ("Ada") use "ADA_PRJ_OBJECTS_FILE"; 61 | end Binder; 62 | 63 | end MyTest; 64 | 65 | -------------------------------------------------------------------------------- /examples/ada-plugin/src/mytest.adb: -------------------------------------------------------------------------------- 1 | -- Robot Testing Framework 2 | -- 3 | -- Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | -- 5 | -- This library is free software; you can redistribute it and/or 6 | -- modify it under the terms of the GNU Lesser General Public 7 | -- License as published by the Free Software Foundation; either 8 | -- version 2.1 of the License, or (at your option) any later version. 9 | -- 10 | -- This library is distributed in the hope that it will be useful, 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | -- Lesser General Public License for more details. 14 | -- 15 | -- You should have received a copy of the GNU Lesser General Public 16 | -- License along with this library; if not, write to the Free Software 17 | -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | with robottestingframework; use robottestingframework; 20 | With robottestingframework.Asserter; 21 | With MyTest; use MyTest; 22 | with Ada.Numerics.discrete_Random; 23 | 24 | package body MyTest is 25 | 26 | package Rand_Int is new Ada.Numerics.Discrete_Random(Positive); 27 | gen : Rand_Int.Generator; 28 | 29 | function RandomNumber(n: in Positive) return Integer is 30 | begin 31 | return Rand_Int.Random(gen) mod n; -- or mod n+1 to include the end value 32 | end RandomNumber; 33 | 34 | procedure Create is 35 | begin 36 | SetTest(new MyTest, "MyTest"); 37 | end; 38 | 39 | function Setup (Self : in out MyTest; 40 | Parameters : String) return Boolean is 41 | pragma Unreferenced (Self); 42 | pragma Unreferenced (Parameters); 43 | begin 44 | Rand_Int.Reset(gen); 45 | Asserter.TestReport("Preparing setup..."); 46 | return True; 47 | end Setup; 48 | 49 | procedure TearDown (Self : in out MyTest) is 50 | pragma Unreferenced (Self); 51 | begin 52 | Asserter.TestReport("Tearing down..."); 53 | end; 54 | 55 | procedure Run (Self : in out MyTest) is 56 | pragma Unreferenced (Self); 57 | n1 : Integer; 58 | n2 : Integer; 59 | begin 60 | for I in Integer range 1 .. 10 loop 61 | n1 := RandomNumber(10); 62 | n2 := RandomNumber(10); 63 | Asserter.TestCheck(n1>n2, 64 | Integer'Image(n1) & " is bigger than " & Integer'Image(n2) & "."); 65 | end loop; 66 | 67 | --Asserter.TestCheck(5>3, "5 is bigger than 3."); 68 | --Asserter.TestCheck(5<3, "5 is smaller than 3."); 69 | end; 70 | 71 | 72 | end MyTest; 73 | 74 | -------------------------------------------------------------------------------- /examples/ada-plugin/src/mytest.ads: -------------------------------------------------------------------------------- 1 | -- Robot Testing Framework 2 | -- 3 | -- Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | -- 5 | -- This library is free software; you can redistribute it and/or 6 | -- modify it under the terms of the GNU Lesser General Public 7 | -- License as published by the Free Software Foundation; either 8 | -- version 2.1 of the License, or (at your option) any later version. 9 | -- 10 | -- This library is distributed in the hope that it will be useful, 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | -- Lesser General Public License for more details. 14 | -- 15 | -- You should have received a copy of the GNU Lesser General Public 16 | -- License along with this library; if not, write to the Free Software 17 | -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | With robottestingframework.TestCase; use robottestingframework.TestCase; 20 | 21 | package MyTest is 22 | 23 | type MyTest is new TestCase with null record; 24 | 25 | overriding function Setup (Self : in out MyTest; 26 | Parameters : String) return Boolean; 27 | overriding procedure TearDown (Self : in out MyTest); 28 | overriding procedure Run(Self : in out MyTest); 29 | 30 | procedure Create; 31 | pragma Export (C, Create, robottestingframework.Test_Create_Symbol); 32 | 33 | private 34 | function RandomNumber (n: in Positive) return Integer; 35 | 36 | end MyTest; 37 | 38 | -------------------------------------------------------------------------------- /examples/fixture-plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | cmake_minimum_required(VERSION 3.5) 21 | 22 | find_package(RobotTestingFramework COMPONENTS DLL) 23 | 24 | set(CMAKE_SHARED_MODULE_PREFIX "") 25 | 26 | add_library(myfixture MODULE MyFixManager.cpp MyFixManager.h) 27 | target_link_libraries(myfixture ${RobotTestingFramework_LIBRARIES}) 28 | 29 | add_executable(test test.cpp) 30 | target_link_libraries(test ${RobotTestingFramework_LIBRARIES}) 31 | -------------------------------------------------------------------------------- /examples/fixture-plugin/MyFixManager.cpp: -------------------------------------------------------------------------------- 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 | #include "MyFixManager.h" 23 | #include 24 | 25 | #include 26 | 27 | using namespace robottestingframework; 28 | 29 | ROBOTTESTINGFRAMEWORK_PREPARE_FIXTURE_PLUGIN(MyFixManager) 30 | 31 | bool MyFixManager::setup(int argc, char** argv) 32 | { 33 | printf("Called from fixture plugin: setupping fixture...\n"); 34 | // do the setup here 35 | // ... 36 | return true; 37 | } 38 | 39 | void MyFixManager::tearDown() 40 | { 41 | printf("Called from fixture plugin: tearing down the fixture...\n"); 42 | // do the tear down here 43 | // ... 44 | } 45 | -------------------------------------------------------------------------------- /examples/fixture-plugin/MyFixManager.h: -------------------------------------------------------------------------------- 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_MYFIXMANAGER_H 23 | #define ROBOTTESTINGFRAMEWORK_MYFIXMANAGER_H 24 | 25 | #include 26 | 27 | class MyFixManager : public FixtureManager 28 | { 29 | public: 30 | bool setup(int argc, char** argv) override; 31 | 32 | void tearDown() override; 33 | }; 34 | 35 | #endif // ROBOTTESTINGFRAMEWORK_MYFIXMANAGER_H 36 | -------------------------------------------------------------------------------- /examples/fixture-plugin/test.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | 33 | using namespace robottestingframework; 34 | using namespace robottestingframework::plugin; 35 | 36 | class MyTest1 : public TestCase 37 | { 38 | public: 39 | MyTest1() : 40 | TestCase("MyTest1") 41 | { 42 | } 43 | 44 | void run() override 45 | { 46 | ROBOTTESTINGFRAMEWORK_TEST_REPORT("testing smaller"); 47 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(3 < 5, "is not smaller"); 48 | } 49 | }; 50 | 51 | 52 | int main(int argc, char* argv[]) 53 | { 54 | 55 | if (argc < 2) { 56 | printf("Usage: %s \n", argv[0]); 57 | printf("for example: %s libmyfixture.so\n", argv[0]); 58 | return 0; 59 | } 60 | 61 | // load the test case plugin 62 | printf("Loading the fixture manager plugin... \n"); 63 | DllFixturePluginLoader loader; 64 | FixtureManager* fixture = loader.open(argv[1]); 65 | if (fixture == NULL) { 66 | printf("%s\n", loader.getLastError().c_str()); 67 | return 0; 68 | } 69 | 70 | // create a test listener to collect the result 71 | ConsoleListener listener(false); 72 | 73 | // create a test result and add the listeners 74 | TestResult result; 75 | result.addListener(&listener); 76 | 77 | // create a test suite 78 | TestSuite suite("MyTestSuite"); 79 | 80 | // set the fixture manager for the test suite 81 | suite.setFixtureManager(fixture); 82 | 83 | // creates test cases and add them to the suite 84 | MyTest1 test1; 85 | suite.addTest(&test1); 86 | 87 | // create a test runner and run the tests 88 | TestRunner runner; 89 | runner.addTest(&suite); 90 | runner.run(result); 91 | 92 | return 0; 93 | } 94 | -------------------------------------------------------------------------------- /examples/lua-plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | cmake_minimum_required(VERSION 3.5) 20 | 21 | find_package(RobotTestingFramework COMPONENTS DLL) 22 | 23 | add_executable(simple_run run.cpp) 24 | target_link_libraries(simple_run RobotTestingFramework::RTF 25 | RobotTestingFramework::RTF_dll) 26 | 27 | -------------------------------------------------------------------------------- /examples/lua-plugin/mytest.lua: -------------------------------------------------------------------------------- 1 | -- Robot Testing Framework 2 | -- 3 | -- Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | -- 5 | -- This library is free software; you can redistribute it and/or 6 | -- modify it under the terms of the GNU Lesser General Public 7 | -- License as published by the Free Software Foundation; either 8 | -- version 2.1 of the License, or (at your option) any later version. 9 | -- 10 | -- This library is distributed in the hope that it will be useful, 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | -- Lesser General Public License for more details. 14 | -- 15 | -- You should have received a copy of the GNU Lesser General Public 16 | -- License along with this library; if not, write to the Free Software 17 | -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | -- 20 | -- The TestCase table is used by the lua plugin loader 21 | -- to invoke the corresponding methods: 22 | -- 23 | -- TestCase.setup = function(options) ... return true end 24 | -- TestCase.run = function() ... end 25 | -- TestCase.tearDown = function() ... end 26 | -- 27 | -- The following methods are for reporting, failures or assertions: 28 | -- 29 | -- robottestingframework.setName(name) : sets the test name (defualt is the test filename) 30 | -- robottestingframework.testReport(msg) : reports a informative message 31 | -- robottestingframework.testCheck(condition, msg) : reports the test message and marks the test as failed if condition is false 32 | -- robottestingframework.testFailIf(condition, msg) : marks the test as failed and reports failure message (the reason) if condition is false 33 | -- robottestingframework.assertError(msg) : throws an error exception with message 34 | -- robottestingframework.asserFail(msg) : throws a failure exception with message 35 | -- robottestingframework.getEnvironment() : returns the test environment params 36 | -- 37 | 38 | -- 39 | -- setup is called before the test's run to setup 40 | -- the user defined fixture 41 | -- @return Boolean (true/false uppon success or failure) 42 | -- 43 | TestCase.setup = function(parameter) 44 | robottestingframework.testReport("Preparing setup...") 45 | return true; 46 | end 47 | 48 | -- 49 | -- The implementation of the test goes here 50 | -- 51 | TestCase.run = function() 52 | robottestingframework.testCheck(5>3, "5 is bigger than 3") 53 | robottestingframework.testCheck(5<3, "5 is less than 3") 54 | end 55 | 56 | 57 | -- 58 | -- tearDown is called after the test's run to tear down 59 | -- the user defined fixture 60 | -- 61 | TestCase.tearDown = function() 62 | robottestingframework.testReport("Tearing down...") 63 | end 64 | 65 | -------------------------------------------------------------------------------- /examples/lua-plugin/run.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | 31 | using namespace robottestingframework; 32 | using namespace robottestingframework::plugin; 33 | 34 | int main(int argc, char* argv[]) 35 | { 36 | 37 | if (argc < 2) { 38 | printf("Usage: %s \n", argv[0]); 39 | printf("for example: %s mytest.lua\n", argv[0]); 40 | return 0; 41 | } 42 | 43 | // load the test case plugin 44 | printf("Loading the plugin... \n"); 45 | LuaPluginLoader loader; 46 | TestCase* test = loader.open(argv[1]); 47 | if (test == NULL) { 48 | printf("%s\n", loader.getLastError().c_str()); 49 | return 0; 50 | } 51 | 52 | // create a test listener to collect the result 53 | ConsoleListener listener(false); 54 | 55 | // create a test result and add the listeners 56 | TestResult result; 57 | result.addListener(&listener); 58 | 59 | // create a test runner and run the test case 60 | TestRunner runner; 61 | runner.addTest(test); 62 | runner.run(result); 63 | 64 | return 0; 65 | } 66 | -------------------------------------------------------------------------------- /examples/plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | cmake_minimum_required(VERSION 3.5) 21 | 22 | find_package(RobotTestingFramework COMPONENTS DLL) 23 | 24 | add_library(mytest MODULE MyTest.cpp MyTest.h) 25 | target_link_libraries(mytest RobotTestingFramework::RTF 26 | RobotTestingFramework::RTF_dll) 27 | 28 | add_executable(simple_run run.cpp) 29 | target_link_libraries(simple_run RobotTestingFramework::RTF 30 | RobotTestingFramework::RTF_dll) 31 | 32 | -------------------------------------------------------------------------------- /examples/plugin/MyTest.cpp: -------------------------------------------------------------------------------- 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 | #include "MyTest.h" 23 | #include 24 | #include 25 | 26 | using namespace robottestingframework; 27 | 28 | ROBOTTESTINGFRAMEWORK_PREPARE_PLUGIN(MyTest) 29 | 30 | MyTest::MyTest() : 31 | TestCase("MyTest") 32 | { 33 | } 34 | 35 | bool MyTest::setup(int argc, char** argv) 36 | { 37 | ROBOTTESTINGFRAMEWORK_TEST_REPORT("running MyTest::setup..."); 38 | return true; 39 | } 40 | 41 | void MyTest::tearDown() 42 | { 43 | ROBOTTESTINGFRAMEWORK_TEST_REPORT("running MyTest::teardown..."); 44 | // assert an arbitray error for example. 45 | ROBOTTESTINGFRAMEWORK_ASSERT_ERROR("this is just for example!"); 46 | } 47 | 48 | void MyTest::run() 49 | { 50 | ROBOTTESTINGFRAMEWORK_TEST_REPORT("testing integers"); 51 | ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF_FALSE(2 < 3, "is not smaller"); 52 | int a = 5; 53 | int b = 3; 54 | ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF_FALSE(a < b, Asserter::format("%d is not smaller than %d.", a, b)); 55 | } 56 | -------------------------------------------------------------------------------- /examples/plugin/MyTest.h: -------------------------------------------------------------------------------- 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_MYTEST_H 23 | #define ROBOTTESTINGFRAMEWORK_MYTEST_H 24 | 25 | #include 26 | 27 | class MyTest : public robottestingframework::TestCase 28 | { 29 | public: 30 | MyTest(); 31 | 32 | bool setup(int argc, char** argv) override; 33 | 34 | void tearDown() override; 35 | 36 | void run() override; 37 | }; 38 | 39 | #endif // ROBOTTESTINGFRAMEWORK_MYTEST_H 40 | -------------------------------------------------------------------------------- /examples/plugin/run.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | 31 | using namespace robottestingframework; 32 | using namespace robottestingframework::plugin; 33 | 34 | int main(int argc, char* argv[]) 35 | { 36 | 37 | if (argc < 2) { 38 | printf("Usage: %s \n", argv[0]); 39 | printf("for example: %s libmytest.so\n", argv[0]); 40 | return 0; 41 | } 42 | 43 | // load the test case plugin 44 | printf("Loading the plugin... \n"); 45 | DllPluginLoader loader; 46 | TestCase* test = loader.open(argv[1]); 47 | if (test == NULL) { 48 | printf("%s\n", loader.getLastError().c_str()); 49 | return 0; 50 | } 51 | 52 | // create a test listener to collect the result 53 | ConsoleListener listener(false); 54 | 55 | // create a test result and add the listeners 56 | TestResult result; 57 | result.addListener(&listener); 58 | 59 | // create a test runner and run the test case 60 | TestRunner runner; 61 | runner.addTest(test); 62 | runner.run(result); 63 | 64 | return 0; 65 | } 66 | -------------------------------------------------------------------------------- /examples/python-plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | cmake_minimum_required(VERSION 3.0) 21 | 22 | find_package(RobotTestingFramework COMPONENTS DLL) 23 | 24 | add_executable(simple_run run.cpp) 25 | target_link_libraries(simple_run RobotTestingFramework::RTF 26 | RobotTestingFramework::RTF_dll) 27 | 28 | -------------------------------------------------------------------------------- /examples/python-plugin/mytest.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Robot Testing Framework 4 | # 5 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 6 | # 7 | # This library is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU Lesser General Public 9 | # License as published by the Free Software Foundation; either 10 | # version 2.1 of the License, or (at your option) any later version. 11 | # 12 | # This library is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public 18 | # License along with this library; if not, write to the Free Software 19 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | 21 | ''' 22 | robottestingframework module is automatically imported by the python plugin loader 23 | to invoke the corresponding test case methods. To develop a new 24 | test case simply implement the following class; (setup and tearDown 25 | methods are optional) : 26 | 27 | class TestCase: 28 | def setup(self, param): 29 | return True 30 | 31 | def run(self): 32 | 33 | def tearDown(self): 34 | 35 | 36 | The following methods are for reporting, failure or assertions: 37 | 38 | robottestingframework.setName(name) : sets the test name (defualt is the test filename) 39 | robottestingframework.testReport(msg) : reports a informative message 40 | robottestingframework.testCheck(condition, msg) : reports the test message and marks the test as failed if condition is false 41 | robottestingframework.assertError(msg) : throws an error exception with message 42 | robottestingframework.asserFail(msg) : throws a failure exception with message 43 | ''' 44 | 45 | class TestCase: 46 | # setup is called before the test's run to setup 47 | # the user defined fixture 48 | # @return Boolean (True/False uppon success or failure) 49 | def setup(self, param): 50 | robottestingframework.testReport("Preparing setup...") 51 | return True 52 | 53 | # The implementation of the test goes here 54 | def run(self): 55 | robottestingframework.testCheck(5>3, "5 is bigger than 3.") 56 | robottestingframework.testCheck(5<3, "5 is smaller than 3.") 57 | 58 | # tearDown is called after the test's run to tear down 59 | # the user defined fixture 60 | def tearDown(self): 61 | robottestingframework.testReport("Tearing down...") 62 | -------------------------------------------------------------------------------- /examples/python-plugin/run.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | 31 | using namespace robottestingframework; 32 | using namespace robottestingframework::plugin; 33 | 34 | int main(int argc, char* argv[]) 35 | { 36 | 37 | if (argc < 2) { 38 | printf("Usage: %s \n", argv[0]); 39 | printf("for example: %s mytest.py\n", argv[0]); 40 | return 0; 41 | } 42 | 43 | // load the test case plugin 44 | printf("Loading the plugin... \n"); 45 | PythonPluginLoader loader; 46 | TestCase* test = loader.open(argv[1]); 47 | if (test == NULL) { 48 | printf("%s\n", loader.getLastError().c_str()); 49 | return 0; 50 | } 51 | 52 | // create a test listener to collect the result 53 | ConsoleListener listener(false); 54 | 55 | // create a test result and add the listeners 56 | TestResult result; 57 | result.addListener(&listener); 58 | 59 | // create a test runner and run the test case 60 | TestRunner runner; 61 | runner.addTest(test); 62 | runner.run(result); 63 | 64 | return 0; 65 | } 66 | -------------------------------------------------------------------------------- /examples/ruby-plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | cmake_minimum_required(VERSION 3.5) 21 | 22 | find_package(RobotTestingFramework COMPONENTS DLL) 23 | 24 | add_executable(simple_run run.cpp) 25 | target_link_libraries(simple_run RobotTestingFramework::RTF 26 | RobotTestingFramework::RTF_dll) 27 | 28 | -------------------------------------------------------------------------------- /examples/ruby-plugin/mytest.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | 3 | # Robot Testing Framework 4 | # 5 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 6 | # 7 | # This library is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU Lesser General Public 9 | # License as published by the Free Software Foundation; either 10 | # version 2.1 of the License, or (at your option) any later version. 11 | # 12 | # This library is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public 18 | # License along with this library; if not, write to the Free Software 19 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | 21 | # robottestingframework module is automatically imported by the ruby plugin loader 22 | # to invoke the corresponding test case methods. To develop a new 23 | # test case simply implement the following class; (setup and tearDown 24 | # methods are optional) : 25 | # 26 | # class TestCase 27 | # def setup(param) 28 | # ... 29 | # return true 30 | # end 31 | # 32 | # def run ... end 33 | # 34 | # def tearDown ... end 35 | # end 36 | # 37 | # The following methods are for reporting, failure or assertions: 38 | # 39 | # RobotTestingFramework::setName(name) : sets the test name (defualt is the test filename) 40 | # RobotTestingFramework::testReport(msg) : reports a informative message 41 | # RobotTestingFramework::testCheck(condition, msg) : reports the test message and marks the test as failed if condition is false 42 | # RobotTestingFramework::assertError(msg) : throws an error exception with message 43 | # RobotTestingFramework::asserFail(msg) : throws a failure exception with message 44 | # 45 | 46 | class TestCase 47 | # setup is called before the test's run to setup 48 | # the user defined fixture 49 | # @return Boolean (True/False uppon success or failure) 50 | def setup(param) 51 | RobotTestingFramework::testReport("Preparing setup...") 52 | return true 53 | end 54 | 55 | # The implementation of the test goes here 56 | def run 57 | RobotTestingFramework::testCheck(5>3, "5 is bigger than 3.") 58 | RobotTestingFramework::testCheck(5<3, "5 is smaller than 3.") 59 | end 60 | 61 | # tearDown is called after the test's run to tear down 62 | # the user defined fixture 63 | def tearDown 64 | RobotTestingFramework::testReport("Tearing down...") 65 | end 66 | end 67 | 68 | -------------------------------------------------------------------------------- /examples/ruby-plugin/run.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | 31 | using namespace robottestingframework; 32 | using namespace robottestingframework::plugin; 33 | 34 | int main(int argc, char* argv[]) 35 | { 36 | 37 | if (argc < 2) { 38 | printf("Usage: %s \n", argv[0]); 39 | printf("for example: %s mytest.rb\n", argv[0]); 40 | return 0; 41 | } 42 | 43 | // load the test case plugin 44 | printf("Loading the plugin... \n"); 45 | RubyPluginLoader loader; 46 | TestCase* test = loader.open(argv[1]); 47 | if (test == NULL) { 48 | printf("%s\n", loader.getLastError().c_str()); 49 | return 0; 50 | } 51 | 52 | // create a test listener to collect the result 53 | ConsoleListener listener(false); 54 | 55 | // create a test result and add the listeners 56 | TestResult result; 57 | result.addListener(&listener); 58 | 59 | // create a test runner and run the test case 60 | TestRunner runner; 61 | runner.addTest(test); 62 | runner.run(result); 63 | 64 | return 0; 65 | } 66 | -------------------------------------------------------------------------------- /examples/simple.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | using namespace robottestingframework; 32 | 33 | class MyTest : public TestCase 34 | { 35 | public: 36 | MyTest() : 37 | TestCase("MyTest") 38 | { 39 | } 40 | 41 | bool setup(int argc, char** argv) override 42 | { 43 | ROBOTTESTINGFRAMEWORK_TEST_REPORT("running MyTest::setup..."); 44 | return true; 45 | } 46 | 47 | void tearDown() override 48 | { 49 | ROBOTTESTINGFRAMEWORK_TEST_REPORT("running MyTest::teardown..."); 50 | ROBOTTESTINGFRAMEWORK_ASSERT_ERROR("this is just for example!"); 51 | } 52 | 53 | void run() override 54 | { 55 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(2 < 3, "two is less than three"); 56 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(2 == 3, "two is equal to three"); 57 | int a = 5; 58 | int b = 3; 59 | ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF_FALSE(a < b, Asserter::format("%d is not smaller than %d.", a, b)); 60 | } 61 | }; 62 | 63 | int main(int argc, char** argv) 64 | { 65 | // create a test listener to collect the result 66 | // and enable the verbose mode 67 | ConsoleListener listener(true); 68 | 69 | // create a collector to get computer readable 70 | // test results 71 | TestResultCollector collector; 72 | 73 | // create a test result and add the listeners 74 | TestResult result; 75 | result.addListener(&listener); 76 | result.addListener(&collector); 77 | 78 | // calling a test case 79 | MyTest atest; 80 | atest.TestCase::run(result); 81 | 82 | // return 0 if the test passed 83 | // otherwise the number of failed test 84 | return collector.failedCount(); 85 | } 86 | -------------------------------------------------------------------------------- /examples/simple_runner.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | using namespace robottestingframework; 32 | 33 | class MyTest : public TestCase 34 | { 35 | public: 36 | MyTest() : 37 | TestCase("MyTest") 38 | { 39 | } 40 | 41 | bool setup(int argc, char** argv) override 42 | { 43 | ROBOTTESTINGFRAMEWORK_TEST_REPORT("running MyTest::setup..."); 44 | return true; 45 | } 46 | 47 | void tearDown() override 48 | { 49 | ROBOTTESTINGFRAMEWORK_TEST_REPORT("running MyTest::teardown..."); 50 | ROBOTTESTINGFRAMEWORK_ASSERT_ERROR("this is just for example!"); 51 | } 52 | 53 | void run() override 54 | { 55 | 56 | ROBOTTESTINGFRAMEWORK_TEST_REPORT("testing integers"); 57 | ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF_FALSE(2 < 3, "is not smaller"); 58 | ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF_FALSE(5 < 3, "is not smaller"); 59 | } 60 | }; 61 | 62 | int main(int argc, char** argv) 63 | { 64 | // create a test listener to collect the result 65 | ConsoleListener listener(false); 66 | 67 | // create a collector to get computer readable 68 | // test results 69 | TestResultCollector collector; 70 | 71 | // create a test result and add the listeners 72 | TestResult result; 73 | result.addListener(&listener); 74 | result.addListener(&collector); 75 | 76 | // create a test runner 77 | TestRunner runner; 78 | MyTest atest; 79 | runner.addTest(&atest); 80 | runner.run(result); 81 | 82 | // return the number of failed tests 83 | return collector.failedCount(); 84 | } 85 | -------------------------------------------------------------------------------- /examples/simple_suite.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | using namespace robottestingframework; 33 | 34 | class MyTest1 : public TestCase 35 | { 36 | public: 37 | MyTest1() : 38 | TestCase("MyTest1") 39 | { 40 | } 41 | 42 | void run() override 43 | { 44 | ROBOTTESTINGFRAMEWORK_TEST_REPORT("testing smaller"); 45 | ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF_FALSE(3 < 5, "is not smaller"); 46 | } 47 | }; 48 | 49 | class MyTest2 : public TestCase 50 | { 51 | public: 52 | MyTest2() : 53 | TestCase("MyTest2") 54 | { 55 | } 56 | 57 | void run() override 58 | { 59 | ROBOTTESTINGFRAMEWORK_TEST_REPORT("testing equality"); 60 | ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF_FALSE(5 == 3, "are not equal"); 61 | } 62 | }; 63 | 64 | 65 | int main(int argc, char** argv) 66 | { 67 | // create a test listener to collect the result 68 | ConsoleListener listener(false); 69 | 70 | // create a collector to get computer readable 71 | // test results 72 | TestResultCollector collector; 73 | 74 | // create a test result and add the listeners 75 | TestResult result; 76 | result.addListener(&listener); 77 | result.addListener(&collector); 78 | 79 | // create a test suite and the test cases 80 | TestSuite suite("MyTestSuite"); 81 | MyTest1 test1; 82 | MyTest2 test2; 83 | suite.addTest(&test1); 84 | suite.addTest(&test2); 85 | 86 | // create a test runner 87 | TestRunner runner; 88 | runner.addTest(&suite); 89 | runner.run(result); 90 | 91 | // return the number of failed tests 92 | return collector.failedCount(); 93 | } 94 | -------------------------------------------------------------------------------- /examples/testrunner/mysuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | a simple suite example 5 | 6 | 7 | libmytest.so 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /extern/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | # Build TinyXml if it is not available 21 | if(BUILD_TESTRUNNER AND NOT TinyXML_FOUND) 22 | add_subdirectory(tinyxml) 23 | endif() 24 | 25 | # Build mongoose 26 | if(ENABLE_WEB_LISTENER) 27 | add_subdirectory(mongoose) 28 | endif() 29 | 30 | -------------------------------------------------------------------------------- /extern/mongoose/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | # Mongoose 21 | 22 | set(mongoose_SRCS src/mongoose.c) 23 | 24 | set(mongoose_HDRS src/mongoose.h) 25 | 26 | add_library(RTF_mongoose OBJECT ${mongoose_SRCS} 27 | ${mongoose_HDRS}) 28 | add_library(RobotTestingFramework::RTF_mongoose ALIAS RTF_mongoose) 29 | 30 | target_include_directories(RTF_mongoose PUBLIC $) 31 | if(NOT WIN32) 32 | # See https://gitlab.kitware.com/cmake/cmake/issues/14778 33 | # See https://gitlab.kitware.com/cmake/cmake/merge_requests/1524 34 | if(NOT ${CMAKE_MINIMUM_REQUIRED_VERSION} VERSION_LESS 3.12) 35 | message(AUTHOR_WARNING "CMAKE_MINIMUM_REQUIRED_VERSION is now ${CMAKE_MINIMUM_REQUIRED_VERSION}. object libraries can be used with target_link_libraries now.") 36 | endif() 37 | # target_link_libraries(RTF_mongoose INTERFACE pthread) 38 | set_target_properties(RTF_mongoose PROPERTIES INTERFACE_LINK_LIBRARIES pthread) 39 | endif() 40 | -------------------------------------------------------------------------------- /extern/tinyxml/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | # TinyXML 21 | 22 | set(TinyXML_SRCS src/tinyxml.cpp 23 | src/tinyxmlerror.cpp 24 | src/tinyxmlparser.cpp) 25 | 26 | set(TinyXML_HDRS src/tinystr.h 27 | src/tinyxml.h) 28 | 29 | add_library(RTF_tinyxml OBJECT ${TinyXML_SRCS} 30 | ${TinyXML_HDRS}) 31 | add_library(RobotTestingFramework::RTF_tinyxml ALIAS RTF_tinyxml) 32 | 33 | target_include_directories(RTF_tinyxml PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src") 34 | target_compile_definitions(RTF_tinyxml PUBLIC TIXML_USE_STL) 35 | -------------------------------------------------------------------------------- /extern/tinyxml/src/changes.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotology/robot-testing-framework/3726e898218430488fd795ea990ccf87df47feed/extern/tinyxml/src/changes.txt -------------------------------------------------------------------------------- /extern/tinyxml/src/tinyxmlerror.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | www.sourceforge.net/projects/tinyxml 3 | Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com) 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any 7 | damages arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any 10 | purpose, including commercial applications, and to alter it and 11 | redistribute it freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must 14 | not claim that you wrote the original software. If you use this 15 | software in a product, an acknowledgment in the product documentation 16 | would be appreciated but is not required. 17 | 18 | 2. Altered source versions must be plainly marked as such, and 19 | must not be misrepresented as being the original software. 20 | 21 | 3. This notice may not be removed or altered from any source 22 | distribution. 23 | */ 24 | 25 | #include "tinyxml.h" 26 | 27 | // The goal of the seperate error file is to make the first 28 | // step towards localization. tinyxml (currently) only supports 29 | // english error messages, but the could now be translated. 30 | // 31 | // It also cleans up the code a bit. 32 | // 33 | 34 | const char* TiXmlBase::errorString[ TiXmlBase::TIXML_ERROR_STRING_COUNT ] = 35 | { 36 | "No error", 37 | "Error", 38 | "Failed to open file", 39 | "Error parsing Element.", 40 | "Failed to read Element name", 41 | "Error reading Element value.", 42 | "Error reading Attributes.", 43 | "Error: empty tag.", 44 | "Error reading end tag.", 45 | "Error parsing Unknown.", 46 | "Error parsing Comment.", 47 | "Error parsing Declaration.", 48 | "Error document empty.", 49 | "Error null (0) or unexpected EOF found in input stream.", 50 | "Error parsing CDATA.", 51 | "Error when TiXmlDocument added to document, because TiXmlDocument can only be at the root.", 52 | }; 53 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | # Build RobotTestingFramework library 21 | add_subdirectory(robottestingframework) 22 | 23 | # build plugin manager 24 | add_subdirectory(plugins) 25 | 26 | # Build robottestingframework-testrunner 27 | if (BUILD_TESTRUNNER) 28 | add_subdirectory(robottestingframework-testrunner) 29 | endif(BUILD_TESTRUNNER) 30 | -------------------------------------------------------------------------------- /src/plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | # build plugin manager 21 | if (ENABLE_PLUGIN OR BUILD_TESTRUNNER) 22 | add_subdirectory(dll) 23 | endif() 24 | 25 | # build Lua plugin manager 26 | if (ENABLE_LUA_PLUGIN) 27 | add_subdirectory(lua) 28 | endif() 29 | 30 | # build Python plugin manager 31 | if (ENABLE_PYTHON_PLUGIN) 32 | add_subdirectory(python) 33 | endif() 34 | 35 | # build Ruby plugin manager 36 | if (ENABLE_RUBY_PLUGIN) 37 | add_subdirectory(ruby) 38 | endif() 39 | -------------------------------------------------------------------------------- /src/plugins/ada/README.md: -------------------------------------------------------------------------------- 1 | The ada plugin folder contains some helper functions (files) to develop test cases using ADA langauge. 2 | Currently these files should be compiled with the necessary code to implement a test case. 3 | 4 | TODO: create an ada helper library 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/plugins/ada/src_ada/robottestingframework-asserter.adb: -------------------------------------------------------------------------------- 1 | -- Robot Testing Framework 2 | -- 3 | -- Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | -- 5 | -- This library is free software; you can redistribute it and/or 6 | -- modify it under the terms of the GNU Lesser General Public 7 | -- License as published by the Free Software Foundation; either 8 | -- version 2.1 of the License, or (at your option) any later version. 9 | -- 10 | -- This library is distributed in the hope that it will be useful, 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | -- Lesser General Public License for more details. 14 | -- 15 | -- You should have received a copy of the GNU Lesser General Public 16 | -- License along with this library; if not, write to the Free Software 17 | -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | With robottestingframework.Asserter; use robottestingframework.Asserter; 20 | with Interfaces.C; use Interfaces.C; 21 | 22 | package body robottestingframework.Asserter is 23 | 24 | procedure Error(Message : String) is 25 | begin 26 | Error_Wrapper(To_C(Message)); 27 | end; 28 | 29 | procedure ErrorIf(Condition : Boolean; 30 | Message : String) is 31 | begin 32 | if not Condition then 33 | Error_Wrapper(To_C(Message)); 34 | end if; 35 | end; 36 | 37 | procedure Fail(Message : String) is 38 | begin 39 | Fail_Wrapper(To_C(Message)); 40 | end; 41 | 42 | procedure FailIf(Condition : Boolean; 43 | Message : String) is 44 | begin 45 | if not Condition then 46 | Fail_Wrapper(To_C(Message)); 47 | end if; 48 | end; 49 | 50 | procedure TestReport(Message : String) is 51 | begin 52 | TestReport_Wrapper(To_C(Message)); 53 | end; 54 | 55 | procedure TestCheck(Condition: Boolean; 56 | Message : String) is 57 | Cond : Interfaces.C.unsigned := 1; 58 | begin 59 | if not Condition then 60 | Cond := 0; 61 | end if; 62 | TestCheck_Wrapper(Cond, To_C(Message)); 63 | end; 64 | 65 | procedure TestFailIf(Condition: Boolean; 66 | Message : String) is 67 | Cond : Interfaces.C.unsigned := 1; 68 | begin 69 | if not Condition then 70 | Cond := 0; 71 | end if; 72 | TestFailIf_Wrapper(Cond, To_C(Message)); 73 | end; 74 | 75 | end robottestingframework.Asserter; 76 | -------------------------------------------------------------------------------- /src/plugins/ada/src_ada/robottestingframework-asserter.ads: -------------------------------------------------------------------------------- 1 | -- Robot Testing Framework 2 | -- 3 | -- Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | -- 5 | -- This library is free software; you can redistribute it and/or 6 | -- modify it under the terms of the GNU Lesser General Public 7 | -- License as published by the Free Software Foundation; either 8 | -- version 2.1 of the License, or (at your option) any later version. 9 | -- 10 | -- This library is distributed in the hope that it will be useful, 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | -- Lesser General Public License for more details. 14 | -- 15 | -- You should have received a copy of the GNU Lesser General Public 16 | -- License along with this library; if not, write to the Free Software 17 | -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | with Interfaces.C; 20 | 21 | package robottestingframework.Asserter is 22 | procedure Error(Message : String); 23 | procedure ErrorIf(Condition : Boolean; 24 | Message : String); 25 | 26 | procedure Fail(Message : String); 27 | procedure FailIf(Condition : Boolean; 28 | Message : String); 29 | 30 | procedure TestReport(Message : String); 31 | procedure TestCheck(Condition: Boolean; 32 | Message : String); 33 | procedure TestFailIf(Condition: Boolean; 34 | Message : String); 35 | 36 | private 37 | procedure TestReport_Wrapper(Message : Interfaces.C.char_array); 38 | pragma Import (C, TestReport_Wrapper, "robottestingframework_test_report"); 39 | 40 | procedure TestCheck_Wrapper(Condition : Interfaces.C.unsigned; 41 | Message : Interfaces.C.char_array); 42 | pragma Import (C, TestCheck_Wrapper, "robottestingframework_test_check"); 43 | 44 | 45 | procedure TestFailIf_Wrapper(Condition : Interfaces.C.unsigned; 46 | Message : Interfaces.C.char_array); 47 | pragma Import (C, TestFailIf_Wrapper, "robottestingframework_test_fail_if"); 48 | 49 | 50 | procedure Error_Wrapper(Message : Interfaces.C.char_array); 51 | pragma Import (C, Error_Wrapper, "robottestingframework_assert_error"); 52 | 53 | procedure Fail_Wrapper(Message : Interfaces.C.char_array); 54 | pragma Import (C, Fail_Wrapper, "robottestingframework_assert_fail"); 55 | 56 | end robottestingframework.Asserter; 57 | -------------------------------------------------------------------------------- /src/plugins/ada/src_ada/robottestingframework-testcase.adb: -------------------------------------------------------------------------------- 1 | -- Robot Testing Framework 2 | -- 3 | -- Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | -- 5 | -- This library is free software; you can redistribute it and/or 6 | -- modify it under the terms of the GNU Lesser General Public 7 | -- License as published by the Free Software Foundation; either 8 | -- version 2.1 of the License, or (at your option) any later version. 9 | -- 10 | -- This library is distributed in the hope that it will be useful, 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | -- Lesser General Public License for more details. 14 | -- 15 | -- You should have received a copy of the GNU Lesser General Public 16 | -- License along with this library; if not, write to the Free Software 17 | -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | With robottestingframework.TestCase; use robottestingframework.TestCase; 20 | with Interfaces.C; use Interfaces.C; 21 | 22 | package body robottestingframework.TestCase is 23 | 24 | function Setup (Self : in out TestCase; 25 | Parameters : String) return Boolean is 26 | pragma Unreferenced (Self); 27 | pragma Unreferenced (Parameters); 28 | begin 29 | return True; 30 | end Setup; 31 | 32 | procedure TearDown (Self : in out TestCase) is null; 33 | 34 | procedure SetTest(Test : TestCase_Access; 35 | Name : String := "Unknown") is 36 | begin 37 | Instance := Test; 38 | setName(Name); 39 | end; 40 | 41 | procedure setName(Name : String) is 42 | begin 43 | SetName_Wrapper(To_C(Name)); 44 | end; 45 | 46 | function SetupTest(Parameters : VarCString) 47 | return Interfaces.C.unsigned is 48 | Ret : Interfaces.C.unsigned := 0; 49 | begin 50 | if Instance.All.Setup(To_Ada(Parameters)) then 51 | Ret := 1; 52 | end if; 53 | return Ret; 54 | end; 55 | 56 | procedure TearDownTest is 57 | begin 58 | Instance.All.TearDown; 59 | end; 60 | 61 | procedure RunTest is 62 | begin 63 | Instance.All.Run; 64 | end; 65 | 66 | end robottestingframework.TestCase; 67 | -------------------------------------------------------------------------------- /src/plugins/ada/src_ada/robottestingframework-testcase.ads: -------------------------------------------------------------------------------- 1 | -- Robot Testing Framework 2 | -- 3 | -- Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | -- 5 | -- This library is free software; you can redistribute it and/or 6 | -- modify it under the terms of the GNU Lesser General Public 7 | -- License as published by the Free Software Foundation; either 8 | -- version 2.1 of the License, or (at your option) any later version. 9 | -- 10 | -- This library is distributed in the hope that it will be useful, 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | -- Lesser General Public License for more details. 14 | -- 15 | -- You should have received a copy of the GNU Lesser General Public 16 | -- License along with this library; if not, write to the Free Software 17 | -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | with Interfaces.C; 20 | 21 | package robottestingframework.TestCase is 22 | 23 | type TestCase is abstract tagged private; 24 | type TestCase_Access is access all TestCase'Class; 25 | 26 | -- primitive operation, will be inherited upon derivation 27 | function Setup (Self : in out TestCase; 28 | Parameters : String) return Boolean; 29 | procedure TearDown (Self : in out TestCase) is null; 30 | procedure Run (Self : in out TestCase) is abstract; 31 | 32 | procedure SetTest(Test : TestCase_Access; 33 | Name : String := "Unknown"); 34 | 35 | procedure SetName(Name : String); 36 | 37 | 38 | private 39 | type TestCase is abstract tagged null record; 40 | Instance : TestCase_Access; 41 | 42 | procedure SetName_Wrapper(Message : Interfaces.C.char_array); 43 | pragma Import (C, SetName_Wrapper, "robottestingframework_test_setname"); 44 | 45 | 46 | subtype VarCString is Interfaces.C.char_array(Interfaces.C.size_t); 47 | function SetupTest(Parameters : VarCString) 48 | return Interfaces.C.unsigned; 49 | pragma Export (C, SetupTest, robottestingframework.Test_Setup_Symbol); 50 | 51 | procedure TearDownTest; 52 | pragma Export (C, TearDownTest, robottestingframework.Test_TearDown_Symbol); 53 | 54 | procedure RunTest; 55 | pragma Export (C, RunTest, robottestingframework.Test_Run_Symbol); 56 | 57 | end robottestingframework.TestCase; 58 | -------------------------------------------------------------------------------- /src/plugins/ada/src_ada/robottestingframework.ads: -------------------------------------------------------------------------------- 1 | -- Robot Testing Framework 2 | -- 3 | -- Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | -- 5 | -- This library is free software; you can redistribute it and/or 6 | -- modify it under the terms of the GNU Lesser General Public 7 | -- License as published by the Free Software Foundation; either 8 | -- version 2.1 of the License, or (at your option) any later version. 9 | -- 10 | -- This library is distributed in the hope that it will be useful, 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | -- Lesser General Public License for more details. 14 | -- 15 | -- You should have received a copy of the GNU Lesser General Public 16 | -- License along with this library; if not, write to the Free Software 17 | -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | package robottestingframework is 20 | 21 | Test_Create_Symbol : constant String := "robottestingframework_test_create"; 22 | Test_Setup_Symbol : constant String := "robottestingframework_test_setup"; 23 | Test_TearDown_Symbol : constant String := "robottestingframework_test_teardown"; 24 | Test_Run_Symbol : constant String := "robottestingframework_test_run"; 25 | Test_SetName_Symbol : constant String := "robottestingframework_test_setname"; 26 | 27 | end robottestingframework; 28 | -------------------------------------------------------------------------------- /src/plugins/dll/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | set(RTF_dll_HDRS include/robottestingframework/dll/DllFixturePluginLoader.h 21 | include/robottestingframework/dll/DllPluginLoader.h 22 | include/robottestingframework/dll/Plugin.h 23 | include/robottestingframework/dll/SharedLibrary.h 24 | include/robottestingframework/dll/SharedLibraryClass.h 25 | include/robottestingframework/dll/SharedLibraryClassApi.h 26 | include/robottestingframework/dll/SharedLibraryClassFactory.h 27 | include/robottestingframework/dll/SharedLibraryFactory.h 28 | include/robottestingframework/dll/Vocab.h 29 | include/robottestingframework/dll/robottestingframework_dll_config.h) 30 | 31 | set(RTF_dll_IMPL_HDRS include/robottestingframework/dll/impl/DllPluginLoader_impl.h) 32 | 33 | set(RTF_dll_SRCS src/DllFixturePluginLoader.cpp 34 | src/DllPluginLoader.cpp 35 | src/SharedLibrary.cpp 36 | src/SharedLibraryFactory.cpp) 37 | 38 | add_library(RTF_dll ${RTF_dll_SRCS} 39 | ${RTF_dll_HDRS} 40 | ${RTF_dll_IMPL_HDRS}) 41 | add_library(RobotTestingFramework::RTF_dll ALIAS RTF_dll) 42 | 43 | target_include_directories(RTF_dll PUBLIC $ 44 | $) 45 | 46 | target_link_libraries(RTF_dll PUBLIC RobotTestingFramework::RTF) 47 | 48 | if(NOT WIN32) 49 | target_link_libraries(RTF_dll PRIVATE dl) 50 | endif() 51 | 52 | target_compile_features(RTF_dll PUBLIC cxx_nullptr) 53 | 54 | set_property(TARGET RTF_dll PROPERTY PUBLIC_HEADER ${RTF_dll_HDRS}) 55 | 56 | set_property(TARGET RTF_dll PROPERTY OUTPUT_NAME robottestingframework-dll) 57 | set_property(TARGET RTF_dll PROPERTY SOVERSION 2) 58 | 59 | install(TARGETS RTF_dll 60 | EXPORT RobotTestingFramework 61 | COMPONENT librobottestingframework-dll 62 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 63 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 64 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 65 | PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/robottestingframework/dll) 66 | -------------------------------------------------------------------------------- /src/plugins/dll/include/robottestingframework/dll/DllFixturePluginLoader.h: -------------------------------------------------------------------------------- 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_DLLFIXTUREPLUGINLOADER_H 23 | #define ROBOTTESTINGFRAMEWORK_DLLFIXTUREPLUGINLOADER_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | namespace robottestingframework { 30 | namespace plugin { 31 | 32 | /** 33 | * @brief The DllFixturePluginLoader loads an test case plug-in and 34 | * gives the direct access to the TestCase. 35 | */ 36 | class DllFixturePluginLoader 37 | { 38 | public: 39 | /** 40 | * DllFixturePluginLoader constructor 41 | */ 42 | DllFixturePluginLoader(); 43 | 44 | /** 45 | * DllFixturePluginLoader destructor 46 | */ 47 | virtual ~DllFixturePluginLoader(); 48 | 49 | /** 50 | * @brief open Loads a test case plugin 51 | * @param filename the plugin filename 52 | * @return A pointer to the test case loaded from the 53 | * plugin or a null pointer in case of failure. 54 | */ 55 | FixtureManager* open(const std::string filename); 56 | 57 | /** 58 | * @brief close Unloads the plugin and deletes any 59 | * allocated memory. 60 | */ 61 | void close(); 62 | 63 | /** 64 | * @brief getLastError gets the last error if any. 65 | * @return returns the last error string. 66 | */ 67 | std::string getLastError(); 68 | 69 | private: 70 | void* implementation; 71 | }; 72 | 73 | } // namespace plugin 74 | } // namespace robottestingframework 75 | 76 | #endif // ROBOTTESTINGFRAMEWORK_DLLFIXTUREPLUGINLOADER_H 77 | -------------------------------------------------------------------------------- /src/plugins/dll/include/robottestingframework/dll/DllPluginLoader.h: -------------------------------------------------------------------------------- 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_DLLPLUGINLOADER_H 23 | #define ROBOTTESTINGFRAMEWORK_DLLPLUGINLOADER_H 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | namespace robottestingframework { 31 | namespace plugin { 32 | 33 | /** 34 | * @brief The DllPluginLoader loads an test case plug-in and 35 | * gives the direct access to the TestCase. 36 | */ 37 | class DllPluginLoader : public PluginLoader 38 | { 39 | 40 | public: 41 | /** 42 | * DllPluginLoader constructor 43 | */ 44 | DllPluginLoader(); 45 | 46 | /** 47 | * DllPluginLoader destructor 48 | */ 49 | ~DllPluginLoader() override; 50 | 51 | /** 52 | * @brief open Loads a test case plugin 53 | * @param filename the plugin filename 54 | * @return A pointer to the test case loaded from the 55 | * plugin or a null pointer in case of failure. 56 | */ 57 | TestCase* open(const std::string filename) override; 58 | 59 | /** 60 | * @brief close Unloads the plugin and deletes any 61 | * allocated memory. 62 | */ 63 | void close() override; 64 | 65 | /** 66 | * @brief getLastError gets the last error if any. 67 | * @return returns the last error string. 68 | */ 69 | std::string getLastError() override; 70 | 71 | private: 72 | void* implementation; 73 | }; 74 | 75 | } // namespace robottestingframework 76 | } // namespace plugin 77 | 78 | #endif // ROBOTTESTINGFRAMEWORK_DLLPLUGINLOADER_H 79 | -------------------------------------------------------------------------------- /src/plugins/dll/include/robottestingframework/dll/Plugin.h: -------------------------------------------------------------------------------- 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_PLUGIN_H 23 | #define ROBOTTESTINGFRAMEWORK_PLUGIN_H 24 | 25 | #include "SharedLibraryClass.h" 26 | 27 | #define ROBOTTESTINGFRAMEWORK_PLUGIN_FACTORY_NAME "robottestingframework_dll_factory" 28 | #define ROBOTTESTINGFRAMEWORK_FIXTURE_FACTORY_NAME "robottestingframework_fixture_factory" 29 | 30 | #define ROBOTTESTINGFRAMEWORK_PREPARE_PLUGIN(classname) SHLIBPP_DEFINE_SHARED_SUBCLASS(robottestingframework_dll_factory, classname, classname) 31 | #define ROBOTTESTINGFRAMEWORK_PREPARE_FIXTURE_PLUGIN(classname) SHLIBPP_DEFINE_SHARED_SUBCLASS(robottestingframework_fixture_factory, classname, classname) 32 | 33 | #endif // ROBOTTESTINGFRAMEWORK_PLUGIN_H 34 | -------------------------------------------------------------------------------- /src/plugins/dll/include/robottestingframework/dll/SharedLibraryClassFactory.h: -------------------------------------------------------------------------------- 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_SHAREDLIBRARYCLASSFACTORY_H 23 | #define ROBOTTESTINGFRAMEWORK_SHAREDLIBRARYCLASSFACTORY_H 24 | 25 | #include 26 | 27 | namespace shlibpp { 28 | template 29 | class SharedLibraryClassFactory; 30 | } 31 | 32 | 33 | /** 34 | * 35 | * A type-safe wrapper for SharedLibraryFactory, committing to 36 | * creation/destruction of instances of a particular super-class. 37 | * Note that we take on faith that the named factory method in the 38 | * named shared library does in fact create the named type. 39 | * 40 | */ 41 | template 42 | class shlibpp::SharedLibraryClassFactory : public SharedLibraryFactory 43 | { 44 | public: 45 | SharedLibraryClassFactory() 46 | { 47 | } 48 | 49 | SharedLibraryClassFactory(const char* dll_name, const char* fn_name = 0 /*nullptr*/) : 50 | SharedLibraryFactory(dll_name, fn_name) 51 | { 52 | } 53 | 54 | T* create() 55 | { 56 | if (!isValid()) 57 | return nullptr; 58 | return (T*)getApi().create(); 59 | } 60 | 61 | void destroy(T* obj) 62 | { 63 | if (!isValid()) 64 | return; 65 | getApi().destroy(obj); 66 | } 67 | }; 68 | 69 | #endif // ROBOTTESTINGFRAMEWORK_SHAREDLIBRARYCLASSFACTORY_H 70 | -------------------------------------------------------------------------------- /src/plugins/dll/include/robottestingframework/dll/Vocab.h: -------------------------------------------------------------------------------- 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_VOCAB_H 23 | #define ROBOTTESTINGFRAMEWORK_VOCAB_H 24 | 25 | #include 26 | 27 | namespace shlibpp { 28 | class Vocab; 29 | 30 | // We need a macro for efficient switching. 31 | constexpr int32_t VOCAB(char a, char b = 0, char c = 0, char d = 0) 32 | { 33 | return ((((int32_t)(d)) << 24) + (((int32_t)(c)) << 16) + (((int32_t)(b)) << 8) + ((int32_t)(a))); 34 | } 35 | } 36 | 37 | 38 | class shlibpp::Vocab 39 | { 40 | public: 41 | static int encode(const std::string& s) 42 | { 43 | char a = '\0'; 44 | char b = '\0'; 45 | char c = '\0'; 46 | char d = '\0'; 47 | if (s.length() >= 1) { 48 | a = s[0]; 49 | if (s.length() >= 2) { 50 | b = s[1]; 51 | if (s.length() >= 3) { 52 | c = s[2]; 53 | if (s.length() >= 4) { 54 | d = s[3]; 55 | } 56 | } 57 | } 58 | } 59 | return VOCAB(a, b, c, d); 60 | } 61 | 62 | 63 | static std::string decode(int code) 64 | { 65 | std::string s; 66 | for (int i = 0; i < 4; i++) { 67 | int ch = code % 256; 68 | if (ch > 0) { 69 | s += ((char)ch); 70 | } 71 | code /= 256; 72 | } 73 | return s; 74 | } 75 | }; 76 | 77 | #endif // ROBOTTESTINGFRAMEWORK_VOCAB_H 78 | -------------------------------------------------------------------------------- /src/plugins/dll/include/robottestingframework/dll/robottestingframework_dll_config.h: -------------------------------------------------------------------------------- 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_DLL_CONFIG_H 23 | #define ROBOTTESTINGFRAMEWORK_DLL_CONFIG_H 24 | 25 | #if defined _WIN32 || defined __CYGWIN__ 26 | # define SHLIBPP_EXPORT __declspec(dllexport) 27 | #else 28 | # if defined SHLIBPP_FILTER_API && __GNUC__ >= 4 29 | # define SHLIBPP_EXPORT __attribute__((visibility("default"))) 30 | # else 31 | # define SHLIBPP_EXPORT 32 | # endif 33 | #endif 34 | 35 | #define SHLIBPP_POINTER_SIZE 8 36 | #define SHLIBPP_SHAREDLIBRARYCLASSAPI_PADDING (30 - 2 * (SHLIBPP_POINTER_SIZE / 4)) 37 | 38 | #endif //ROBOTTESTINGFRAMEWORK_DLL_CONFIG_H 39 | -------------------------------------------------------------------------------- /src/plugins/dll/src/DllFixturePluginLoader.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | using namespace std; 28 | using namespace robottestingframework; 29 | using namespace robottestingframework::plugin; 30 | using namespace shlibpp; 31 | 32 | /** 33 | * @brief DllFixturePluginLoader 34 | */ 35 | DllFixturePluginLoader::DllFixturePluginLoader() : 36 | implementation(nullptr) 37 | { 38 | } 39 | 40 | DllFixturePluginLoader::~DllFixturePluginLoader() 41 | { 42 | close(); 43 | } 44 | 45 | void DllFixturePluginLoader::close() 46 | { 47 | if (implementation != nullptr) { 48 | delete ((DllPluginLoaderImpl*)implementation); 49 | } 50 | implementation = nullptr; 51 | } 52 | 53 | FixtureManager* DllFixturePluginLoader::open(const std::string filename) 54 | { 55 | close(); 56 | implementation = new DllPluginLoaderImpl(); 57 | return ((DllPluginLoaderImpl*)implementation)->open(filename, ROBOTTESTINGFRAMEWORK_FIXTURE_FACTORY_NAME); 58 | } 59 | 60 | std::string DllFixturePluginLoader::getLastError() 61 | { 62 | if (implementation != nullptr) { 63 | return ((DllPluginLoaderImpl*)implementation)->getLastError(); 64 | } 65 | return string(""); 66 | } 67 | -------------------------------------------------------------------------------- /src/plugins/dll/src/DllPluginLoader.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | #include 24 | #include 25 | 26 | using namespace std; 27 | using namespace robottestingframework; 28 | using namespace robottestingframework::plugin; 29 | using namespace shlibpp; 30 | 31 | /** 32 | * @brief DllPluginLoader 33 | */ 34 | DllPluginLoader::DllPluginLoader() : 35 | implementation(nullptr) 36 | { 37 | } 38 | 39 | DllPluginLoader::~DllPluginLoader() 40 | { 41 | close(); 42 | } 43 | 44 | void DllPluginLoader::close() 45 | { 46 | if (implementation != nullptr) { 47 | delete ((DllPluginLoaderImpl*)implementation); 48 | } 49 | implementation = nullptr; 50 | } 51 | 52 | TestCase* DllPluginLoader::open(const std::string filename) 53 | { 54 | close(); 55 | implementation = new DllPluginLoaderImpl(); 56 | return ((DllPluginLoaderImpl*)implementation)->open(filename, ROBOTTESTINGFRAMEWORK_PLUGIN_FACTORY_NAME); 57 | } 58 | 59 | std::string DllPluginLoader::getLastError() 60 | { 61 | if (implementation != nullptr) { 62 | return ((DllPluginLoaderImpl*)implementation)->getLastError(); 63 | } 64 | return string(""); 65 | } 66 | -------------------------------------------------------------------------------- /src/plugins/lua/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | find_package(Lua) 21 | if(NOT LUA_FOUND) 22 | find_package(Lua53) 23 | elseif(NOT LUA_FOUND) 24 | find_package(Lua52) 25 | elseif(NOT LUA_FOUND) 26 | find_package(Lua51 REQUIRED) 27 | endif() 28 | 29 | set(RTF_lua_HDRS include/robottestingframework/lua/LuaPluginLoader.h) 30 | 31 | set(RTF_lua_IMPL_HDRS include/robottestingframework/lua/impl/LuaPluginLoader_impl.h) 32 | 33 | set(RTF_lua_SRCS src/LuaPluginLoader.cpp) 34 | 35 | add_library(RTF_lua ${RTF_lua_SRCS} 36 | ${RTF_lua_HDRS} 37 | ${RTF_lua_IMPL_HDRS}) 38 | add_library(RobotTestingFramework::RTF_lua ALIAS RTF_lua) 39 | 40 | target_include_directories(RTF_lua PUBLIC $ 41 | $ 42 | PRIVATE ${LUA_INCLUDE_DIR}) 43 | 44 | target_link_libraries(RTF_lua PUBLIC RobotTestingFramework::RTF 45 | RobotTestingFramework::RTF_dll 46 | PRIVATE ${LUA_LIBRARY}) 47 | 48 | target_compile_features(RTF_lua PUBLIC cxx_nullptr) 49 | 50 | set_property(TARGET RTF_lua PROPERTY PUBLIC_HEADER ${RTF_lua_HDRS}) 51 | 52 | set_property(TARGET RTF_lua PROPERTY OUTPUT_NAME robottestingframework-lua) 53 | set_property(TARGET RTF_lua PROPERTY SOVERSION 2) 54 | 55 | install(TARGETS RTF_lua 56 | EXPORT RobotTestingFramework 57 | COMPONENT librobottestingframework-lua 58 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 59 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 60 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 61 | PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/robottestingframework/lua) 62 | -------------------------------------------------------------------------------- /src/plugins/lua/include/robottestingframework/lua/LuaPluginLoader.h: -------------------------------------------------------------------------------- 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_LUAPLUGINLOADER_H 23 | #define ROBOTTESTINGFRAMEWORK_LUAPLUGINLOADER_H 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | namespace robottestingframework { 31 | namespace plugin { 32 | 33 | /** 34 | * @brief The LuaPluginLoader loads an test case plug-in and 35 | * gives the direct access to the TestCase. 36 | */ 37 | class LuaPluginLoader : public PluginLoader 38 | { 39 | public: 40 | /** 41 | * LuaPluginLoader constructor 42 | */ 43 | LuaPluginLoader(); 44 | 45 | /** 46 | * LuaPluginLoader destructor 47 | */ 48 | ~LuaPluginLoader() override; 49 | 50 | /** 51 | * @brief open Loads a test case plugin 52 | * @param filename the plugin filename 53 | * @return A pointer to the test case loaded from the 54 | * plugin or a null pointer in case of failure. 55 | */ 56 | TestCase* open(const std::string filename) override; 57 | 58 | /** 59 | * @brief close Unloads the plugin and deletes any 60 | * allocated memory. 61 | */ 62 | void close() override; 63 | 64 | /** 65 | * @brief getLastError gets the last error if any. 66 | * @return returns the last error string. 67 | */ 68 | std::string getLastError() override; 69 | 70 | private: 71 | void* implementation; 72 | }; 73 | 74 | } // namespace robottestingframework 75 | } // namespace plugin 76 | 77 | #endif // ROBOTTESTINGFRAMEWORK_LUAPLUGINLOADER_H 78 | -------------------------------------------------------------------------------- /src/plugins/python/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | set(RobotTestingFramework_USE_PYTHON_VERSION "" CACHE STRING "Specify python version to use (only Python 2 is supported at the moment)" ) 21 | 22 | if(RobotTestingFramework_USE_PYTHON_VERSION) 23 | if("${RobotTestingFramework_USE_PYTHON_VERSION}" MATCHES "^3") 24 | message(SEND_ERROR "Python 3 not supported. Only Python 2 is supported at the moment.") 25 | endif() 26 | find_package(PythonInterp ${RobotTestingFramework_USE_PYTHON_VERSION} REQUIRED) 27 | find_package(PythonLibs ${RobotTestingFramework_USE_PYTHON_VERSION} EXACT REQUIRED) 28 | else() 29 | find_package(PythonInterp REQUIRED) 30 | find_package(PythonLibs REQUIRED) 31 | endif() 32 | 33 | set(RTF_python_HDRS include/robottestingframework/python/PythonPluginLoader.h) 34 | 35 | set(RTF_python_IMPL_HDRS include/robottestingframework/python/impl/PythonPluginLoader_impl.h) 36 | 37 | set(RTF_python_SRCS src/PythonPluginLoader.cpp) 38 | 39 | add_library(RTF_python ${RTF_python_SRCS} 40 | ${RTF_python_HDRS} 41 | ${RTF_python_IMPL_HDRS}) 42 | add_library(RobotTestingFramework::RTF_python ALIAS RTF_python) 43 | 44 | target_include_directories(RTF_python PUBLIC $ 45 | $ 46 | PRIVATE ${PYTHON_INCLUDE_DIRS}) 47 | 48 | target_link_libraries(RTF_python PUBLIC RobotTestingFramework::RTF 49 | RobotTestingFramework::RTF_dll 50 | PRIVATE ${PYTHON_LIBRARY}) 51 | 52 | target_compile_features(RTF_python PUBLIC cxx_nullptr) 53 | 54 | set_property(TARGET RTF_python PROPERTY PUBLIC_HEADER ${RTF_python_HDRS}) 55 | 56 | set_property(TARGET RTF_python PROPERTY OUTPUT_NAME robottestingframework-python) 57 | set_property(TARGET RTF_python PROPERTY SOVERSION 2) 58 | 59 | install(TARGETS RTF_python 60 | EXPORT RobotTestingFramework 61 | COMPONENT robottestingframework-python 62 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 63 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 64 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 65 | PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/robottestingframework/python) 66 | 67 | 68 | -------------------------------------------------------------------------------- /src/plugins/python/include/robottestingframework/python/PythonPluginLoader.h: -------------------------------------------------------------------------------- 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_PYTHONPLUGINLOADER_H 23 | #define ROBOTTESTINGFRAMEWORK_PYTHONPLUGINLOADER_H 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | namespace robottestingframework { 31 | namespace plugin { 32 | 33 | /** 34 | * @brief The PythonPluginLoader loads a Python test case plug-in and 35 | * gives the direct access to the TestCase. 36 | */ 37 | class PythonPluginLoader : public PluginLoader 38 | { 39 | 40 | public: 41 | /** 42 | * PythonPluginLoader constructor 43 | */ 44 | PythonPluginLoader(); 45 | 46 | /** 47 | * PythonPluginLoader destructor 48 | */ 49 | virtual ~PythonPluginLoader(); 50 | 51 | /** 52 | * @brief open Loads a test case plugin 53 | * @param filename the pyhton plugin filename 54 | * @return A pointer to the test case loaded from the 55 | * plugin or a null pointer in case of failure. 56 | */ 57 | TestCase* open(const std::string filename) override; 58 | 59 | /** 60 | * @brief close Unloads the plugin and deletes any 61 | * allocated memory. 62 | */ 63 | void close() override; 64 | 65 | /** 66 | * @brief getLastError gets the last error if any. 67 | * @return returns the last error string. 68 | */ 69 | std::string getLastError() override; 70 | 71 | private: 72 | void* implementation; 73 | }; 74 | 75 | } // namespace plugin 76 | } // namespace robottestingframework 77 | 78 | #endif // ROBOTTESTINGFRAMEWORK_PYTHONPLUGINLOADER_H 79 | -------------------------------------------------------------------------------- /src/plugins/ruby/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | find_package(Ruby REQUIRED) 20 | 21 | set(RTF_ruby_HDRS include/robottestingframework/ruby/RubyPluginLoader.h) 22 | 23 | set(RTF_ruby_IMPL_HDRS include/robottestingframework/ruby/impl/RubyPluginLoader_impl.h) 24 | 25 | set(RTF_ruby_SRCS src/RubyPluginLoader.cpp) 26 | 27 | add_library(RTF_ruby ${RTF_ruby_SRCS} 28 | ${RTF_ruby_HDRS} 29 | ${RTF_ruby_IMPL_HDRS}) 30 | add_library(RobotTestingFramework::RTF_ruby ALIAS RTF_ruby) 31 | 32 | target_include_directories(RTF_ruby PUBLIC $ 33 | $ 34 | PRIVATE ${RUBY_INCLUDE_DIRS}) 35 | 36 | target_link_libraries(RTF_ruby PUBLIC RobotTestingFramework::RTF 37 | RobotTestingFramework::RTF_dll 38 | PRIVATE ${RUBY_LIBRARY}) 39 | 40 | target_compile_features(RTF_ruby PUBLIC cxx_nullptr) 41 | 42 | set_property(TARGET RTF_ruby PROPERTY PUBLIC_HEADER ${RTF_ruby_HDRS}) 43 | 44 | set_property(TARGET RTF_ruby PROPERTY OUTPUT_NAME robottestingframework-ruby) 45 | set_property(TARGET RTF_ruby PROPERTY SOVERSION 2) 46 | 47 | install(TARGETS RTF_ruby 48 | EXPORT RobotTestingFramework 49 | COMPONENT librobottestingframework-ruby 50 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 51 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 52 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 53 | PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/robottestingframework/ruby) 54 | -------------------------------------------------------------------------------- /src/plugins/ruby/include/robottestingframework/ruby/RubyPluginLoader.h: -------------------------------------------------------------------------------- 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_RUBYPLUGINLOADER_H 23 | #define ROBOTTESTINGFRAMEWORK_RUBYPLUGINLOADER_H 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | namespace robottestingframework { 31 | namespace plugin { 32 | 33 | /** 34 | * @brief The RubyPluginLoader loads a ruby test case plug-in and 35 | * gives the direct access to the TestCase. 36 | */ 37 | class RubyPluginLoader : public PluginLoader 38 | { 39 | 40 | public: 41 | /** 42 | * RubyPluginLoader constructor 43 | */ 44 | RubyPluginLoader(); 45 | 46 | /** 47 | * RubyPluginLoader destructor 48 | */ 49 | ~RubyPluginLoader() override; 50 | 51 | /** 52 | * @brief open Loads a test case plugin 53 | * @param filename the plugin filename 54 | * @return A pointer to the test case loaded from the 55 | * plugin or a null pointer in case of failure. 56 | */ 57 | TestCase* open(const std::string filename) override; 58 | 59 | /** 60 | * @brief close Unloads the plugin and deletes any 61 | * allocated memory. 62 | */ 63 | void close() override; 64 | 65 | /** 66 | * @brief getLastError gets the last error if any. 67 | * @return returns the last error string. 68 | */ 69 | std::string getLastError() override; 70 | 71 | private: 72 | void* implementation; 73 | }; 74 | 75 | } // namespace plugin 76 | } // namespace robottestingframework 77 | 78 | #endif // ROBOTTESTINGFRAMEWORK_RUBYPLUGINLOADER_H 79 | -------------------------------------------------------------------------------- /src/robottestingframework-testrunner/include/ErrorLogger.h: -------------------------------------------------------------------------------- 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_ERRORLOGGER_H 23 | #define ROBOTTESTINGFRAMEWORK_ERRORLOGGER_H 24 | 25 | #include 26 | #include 27 | 28 | /** 29 | * class ErrorLogger (singleton) 30 | */ 31 | class ErrorLogger 32 | { 33 | 34 | public: 35 | /** 36 | * @brief Instance get an instance of the 37 | * ErrorLogger singleton class 38 | * @return 39 | */ 40 | static ErrorLogger& Instance(); 41 | 42 | /** 43 | * @brief addWarning adds warining to the logger 44 | * @param message warning message 45 | */ 46 | void addWarning(const std::string message); 47 | 48 | /** 49 | * @brief addError adds error to the logger 50 | * @param message error message 51 | */ 52 | void addError(const std::string message); 53 | 54 | /** 55 | * @brief getLastError gets the last error 56 | * from the logger 57 | * @return error message 58 | */ 59 | std::string getLastError(); 60 | 61 | /** 62 | * @brief getLastWarning gets the last warning 63 | * from the logger 64 | * @return 65 | */ 66 | std::string getLastWarning(); 67 | 68 | /** 69 | * @brief reset clears logger 70 | */ 71 | void reset(); 72 | 73 | /** 74 | * @brief errorCount 75 | * @return number of errors 76 | */ 77 | unsigned int errorCount(void); 78 | 79 | /** 80 | * @brief warningCount 81 | * @return number of warnings 82 | */ 83 | unsigned int warningCount(void); 84 | 85 | private: 86 | // make private constructor 87 | ErrorLogger() 88 | { 89 | } 90 | ErrorLogger(ErrorLogger const&) 91 | { 92 | } 93 | 94 | static ErrorLogger* pInstance; 95 | std::vector errors; 96 | std::vector warnings; 97 | }; 98 | 99 | #endif // ROBOTTESTINGFRAMEWORK_ERRORLOGGER_H 100 | -------------------------------------------------------------------------------- /src/robottestingframework-testrunner/include/JUnitOutputter.h: -------------------------------------------------------------------------------- 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_JUNITOUTPUTTER_H 23 | #define ROBOTTESTINGFRAMEWORK_JUNITOUTPUTTER_H 24 | 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | namespace robottestingframework { 32 | 33 | /** 34 | * \brief Class JUnitOutputter saves the results of the test collected by 35 | * a TestResultCollector in a JUnit XML file. 36 | */ 37 | class JUnitOutputter 38 | { 39 | public: 40 | /** 41 | * @brief JUnitOutputter constructor. 42 | * @param collector an instance of a TestResultCollector which holds 43 | * the results of the test 44 | * @param verbose enables the verbose mode. If \c true, the source file and 45 | * the line number where the messages are issued by the tests will be written to 46 | * the output file. The verbose mode is disabled by default. 47 | */ 48 | JUnitOutputter(TestResultCollector& collector, 49 | bool verbose = false); 50 | 51 | /** 52 | * @brief ~JUnitOutputter destructor 53 | */ 54 | virtual ~JUnitOutputter(); 55 | 56 | /** 57 | * @brief write Write the results of the test in a JUnit XML file. 58 | * @param filename the name of the text file. If an instance of 59 | * the TestMesagge is given to the function, it will return the error 60 | * message in case of failure. 61 | * @param errorMsg a pointer to a TestMessage to return the error message 62 | * in case of failure. It can be left unassigned if it is not required. 63 | * @return true or false uppoun success or failure 64 | */ 65 | bool write(std::string filename, 66 | TestMessage* errorMsg = nullptr); 67 | 68 | private: 69 | bool verbose; 70 | TestResultCollector& collector; 71 | }; 72 | 73 | } // namespace robottestingframework 74 | 75 | #endif // ROBOTTESTINGFRAMEWORK_JUNITOUTPUTTER_H 76 | -------------------------------------------------------------------------------- /src/robottestingframework-testrunner/include/PluginRunner.h: -------------------------------------------------------------------------------- 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_PLUGINRUNNER_H 23 | #define ROBOTTESTINGFRAMEWORK_PLUGINRUNNER_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | #include 31 | 32 | /** 33 | * class PluginRunner 34 | */ 35 | class PluginRunner : public robottestingframework::TestRunner 36 | { 37 | 38 | public: 39 | /** 40 | * PluginRunner constructor 41 | */ 42 | PluginRunner(bool verbose = false); 43 | 44 | /** 45 | * PluginRunner destructor 46 | */ 47 | virtual ~PluginRunner(); 48 | 49 | /** 50 | * @brief loadPlugin loads a single test plugin 51 | * @param filename the plugin file name 52 | * @param param the optional test case parameter 53 | * @return true or false upon success or failure 54 | */ 55 | bool loadPlugin(std::string filename, 56 | const unsigned int repetition, 57 | const std::string param = "", 58 | const std::string environment = ""); 59 | 60 | /** 61 | * @brief loadSinglePlugin loads all plugins from the 62 | * given path 63 | * @param path the path to the plugin files 64 | * @param recursive loads from subfolders if true 65 | * @return true or false upon success or failure 66 | */ 67 | bool loadMultiplePlugins(std::string path, bool recursive = false); 68 | 69 | /** 70 | * Clear the test list 71 | */ 72 | void reset(); 73 | 74 | protected: 75 | std::vector dllLoaders; 76 | 77 | private: 78 | bool loadPluginsFromPath(std::string path); 79 | 80 | private: 81 | bool verbose; 82 | }; 83 | 84 | #endif // ROBOTTESTINGFRAMEWORK_PLUGINRUNNER_H 85 | -------------------------------------------------------------------------------- /src/robottestingframework-testrunner/include/SuiteRunner.h: -------------------------------------------------------------------------------- 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_SuiteRunner_H 23 | #define ROBOTTESTINGFRAMEWORK_SuiteRunner_H 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | /** 33 | * class SuiteRunner 34 | */ 35 | class SuiteRunner : public PluginRunner 36 | { 37 | 38 | public: 39 | /** 40 | * SuiteRunner constructor 41 | */ 42 | SuiteRunner(bool verbose = false); 43 | 44 | /** 45 | * SuiteRunner destructor 46 | */ 47 | virtual ~SuiteRunner(); 48 | 49 | /** 50 | * @brief loadSuite loads a single test suite (xml file) 51 | * @param filename the xml file name 52 | * @return true or false upon success or failure 53 | */ 54 | bool loadSuite(std::string filename); 55 | 56 | /** 57 | * @brief loadMultipleSuites loads all test suites from the 58 | * given path 59 | * @param path the path to the test suites xml files 60 | * @param recursive loads from subfolders if true 61 | * @return true or false upon success or failure 62 | */ 63 | bool loadMultipleSuites(std::string path, bool recursive = false); 64 | 65 | /** 66 | * Clear the test list 67 | */ 68 | void reset(); 69 | 70 | private: 71 | bool loadSuitesFromPath(std::string path); 72 | 73 | private: 74 | bool verbose; 75 | std::vector suites; 76 | std::vector fixtureLoaders; 77 | }; 78 | 79 | #endif // ROBOTTESTINGFRAMEWORK_SuiteRunner_H 80 | -------------------------------------------------------------------------------- /src/robottestingframework-testrunner/include/Version.h.in: -------------------------------------------------------------------------------- 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_TESTRUNNER_VERSION_H 23 | #define ROBOTTESTINGFRAMEWORK_TESTRUNNER_VERSION_H 24 | 25 | #define TESTRUNNER_VERSION_MAJOR "@RobotTestingFramework_VERSION_MAJOR@" 26 | #define TESTRUNNER_VERSION_MINOR "@RobotTestingFramework_VERSION_MINOR@" 27 | #define TESTRUNNER_VERSION_PATCH "@RobotTestingFramework_VERSION_PATCH@" 28 | #define TESTRUNNER_VERSION TESTRUNNER_VERSION_MAJOR "." TESTRUNNER_VERSION_MINOR "." TESTRUNNER_VERSION_PATCH 29 | 30 | #endif // ROBOTTESTINGFRAMEWORK_TESTRUNNER_VERSION_H 31 | -------------------------------------------------------------------------------- /src/robottestingframework-testrunner/src/ErrorLogger.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | 24 | using namespace std; 25 | 26 | // Global static pointer used to ensure a single instance of the class. 27 | ErrorLogger* ErrorLogger::pInstance = nullptr; 28 | 29 | 30 | ErrorLogger& ErrorLogger::Instance() 31 | { 32 | if (pInstance == nullptr) { 33 | pInstance = new ErrorLogger; 34 | } 35 | return *pInstance; 36 | } 37 | 38 | 39 | void ErrorLogger::addWarning(const std::string message) 40 | { 41 | warnings.push_back(message); 42 | } 43 | 44 | void ErrorLogger::addError(const std::string message) 45 | { 46 | errors.push_back(message); 47 | } 48 | 49 | 50 | std::string ErrorLogger::getLastError() 51 | { 52 | if (errors.empty()) { 53 | return ""; 54 | } 55 | static string msg; 56 | msg = errors.back(); 57 | errors.pop_back(); 58 | return msg; 59 | } 60 | 61 | std::string ErrorLogger::getLastWarning() 62 | { 63 | if (warnings.empty()) { 64 | return ""; 65 | } 66 | static string msg; 67 | msg = warnings.back(); 68 | warnings.pop_back(); 69 | return msg; 70 | } 71 | 72 | void ErrorLogger::reset() 73 | { 74 | errors.clear(); 75 | warnings.clear(); 76 | } 77 | 78 | unsigned int ErrorLogger::errorCount() 79 | { 80 | return errors.size(); 81 | } 82 | 83 | unsigned int ErrorLogger::warningCount() 84 | { 85 | 86 | return warnings.size(); 87 | } 88 | -------------------------------------------------------------------------------- /src/robottestingframework/include/robottestingframework/Arguments.h: -------------------------------------------------------------------------------- 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_ARGUMENTS_H 23 | #define ROBOTTESTINGFRAMEWORK_ARGUMENTS_H 24 | 25 | namespace robottestingframework { 26 | 27 | /** 28 | * \ingroup key_class 29 | * 30 | * \brief A class to implememnt a arguments parser. 31 | */ 32 | class Arguments 33 | { 34 | public: 35 | /** 36 | * @brief parse Parses a string parameters into argc, argv format 37 | * @param azParam Input string parmater 38 | * @param argc The parsed argument count 39 | * @param argv The parsed arguments 40 | */ 41 | static void parse(char* azParam, 42 | int* argc, 43 | char** argv); 44 | 45 | private: 46 | /** 47 | * @brief split Splits a line into arguments 48 | * @param line A line 49 | * @param args Splited arguments 50 | */ 51 | static void split(char* line, char** args); 52 | }; 53 | 54 | } // robottestingframework 55 | 56 | #endif // ROBOTTESTINGFRAMEWORK_ARGUMENTS_H 57 | -------------------------------------------------------------------------------- /src/robottestingframework/include/robottestingframework/PluginLoader.h: -------------------------------------------------------------------------------- 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 | #ifndef ROBOTTESTINGFRAMEWORK_PLUGINLOADER_H 22 | #define ROBOTTESTINGFRAMEWORK_PLUGINLOADER_H 23 | 24 | #include 25 | 26 | #include 27 | 28 | namespace robottestingframework { 29 | namespace plugin { 30 | 31 | /** 32 | * @brief The PluginLoader is an abstract class for loading a test case plug-in and 33 | * gives the direct access to the TestCase. The PluginLoader class needs to be implemented 34 | * by a plugin-specific loader. 35 | */ 36 | class PluginLoader 37 | { 38 | public: 39 | /** 40 | * PluginLoader constructor 41 | */ 42 | PluginLoader() = default; 43 | 44 | /** 45 | * PluginLoader destructor 46 | */ 47 | virtual ~PluginLoader() = default; 48 | 49 | /** 50 | * @brief open Loads a test case plugin 51 | * @param filename the plugin filename 52 | * @return A pointer to the test case loaded from the 53 | * plugin or a null pointer in case of failure. 54 | */ 55 | virtual TestCase* open(const std::string filename) = 0; 56 | 57 | /** 58 | * @brief close Unloads the plugin and deletes any 59 | * allocated memory. 60 | */ 61 | virtual void close() = 0; 62 | 63 | /** 64 | * @brief getLastError gets the last error if any. 65 | * @return returns the last error string. 66 | */ 67 | virtual std::string getLastError() = 0; 68 | }; 69 | 70 | } // namespace plugin 71 | } // namespace robottestingframework 72 | 73 | #endif // ROBOTTESTINGFRAMEWORK_PLUGINLOADER_H 74 | -------------------------------------------------------------------------------- /src/robottestingframework/include/robottestingframework/TestRunner.h: -------------------------------------------------------------------------------- 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_TESTRUNNER_H 23 | #define ROBOTTESTINGFRAMEWORK_TESTRUNNER_H 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | namespace robottestingframework { 31 | 32 | /** 33 | * \ingroup key_class 34 | * 35 | * \brief The TestRunner class runs the tests added as TestCase or TestSuite. 36 | * It simply goes through a list of the tests and run them one after each other. 37 | * 38 | * Here's an example of using a TestRunner: 39 | * \include examples/simple_runner.cpp 40 | */ 41 | class TestRunner 42 | { 43 | 44 | typedef std::vector TestContainer; 45 | typedef std::vector::iterator TestIterator; 46 | 47 | 48 | public: 49 | /** 50 | * TestRunner constructor 51 | */ 52 | TestRunner(); 53 | 54 | /** 55 | * TestRunner destructor 56 | */ 57 | virtual ~TestRunner(); 58 | 59 | /** 60 | * Adding a new test 61 | * @param test pointer to a Test object 62 | */ 63 | void addTest(Test* test); 64 | 65 | /** 66 | * Remove a test 67 | * @param test pointer to a Test object 68 | */ 69 | void removeTest(Test* test); 70 | 71 | /** 72 | * Clear the test list 73 | */ 74 | void reset(); 75 | 76 | /** 77 | * Run all the tests in the list 78 | * @param result an instance of a TestResult 79 | * to collect the result of the test. 80 | */ 81 | void run(TestResult& result); 82 | 83 | /** 84 | * @brief interrupt interrupts the current test run 85 | */ 86 | void interrupt(); 87 | 88 | private: 89 | TestContainer tests; 90 | Test* current; 91 | bool interrupted; 92 | }; 93 | 94 | } // namespace robottestingframework 95 | 96 | #endif // ROBOTTESTINGFRAMEWORK_TESTRUNNER_H 97 | -------------------------------------------------------------------------------- /src/robottestingframework/include/robottestingframework/TextOutputter.h: -------------------------------------------------------------------------------- 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_TEXTOUTPUTTER_H 23 | #define ROBOTTESTINGFRAMEWORK_TEXTOUTPUTTER_H 24 | 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | namespace robottestingframework { 32 | 33 | /** 34 | * \brief Class TextOutputter saves the results of the test collected by 35 | * a TestResultCollector in a plain text file. The results are 36 | * written with the same order collected by the TestResultCollector. 37 | * 38 | * \ingroup key_class 39 | * 40 | * Here's an example of using a TextOutputter: 41 | * \include examples/simple_collector.cpp 42 | */ 43 | class TextOutputter 44 | { 45 | public: 46 | /** 47 | * @brief TextOutputter constructor. 48 | * @param collector an instance of a TestResultCollector which holds 49 | * the results of the test 50 | * @param verbose enables the verbose mode. If \c true, the source file and 51 | * the line number where the messages are issued by the tests will be written to 52 | * the output file. The verbose mode is disabled by default. 53 | */ 54 | TextOutputter(TestResultCollector& collector, 55 | bool verbose = false); 56 | 57 | /** 58 | * @brief ~TextOutputter destructor 59 | */ 60 | virtual ~TextOutputter(); 61 | 62 | /** 63 | * @brief write Write the results of the test in a text file. 64 | * @param filename the name of the text file. If an instance of 65 | * the TestMesagge is given to the function, it will return the error 66 | * message in case of failure. 67 | * @param errorMsg a pointer to a TestMessage to return the error message 68 | * in case of failure. It can be left unassigned if it is not required. 69 | * @return true or false uppoun success or failure 70 | */ 71 | bool write(std::string filename, 72 | bool summary, 73 | TestMessage* errorMsg = nullptr); 74 | 75 | private: 76 | bool verbose; 77 | TestResultCollector& collector; 78 | }; 79 | 80 | } // namespace robottestingframework 81 | 82 | #endif // ROBOTTESTINGFRAMEWORK_TEXTOUTPUTTER_H 83 | -------------------------------------------------------------------------------- /src/robottestingframework/src/Arguments.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | 24 | #include 25 | 26 | #define C_MAXARGS 128 // max number of the command parametes 27 | 28 | using namespace robottestingframework; 29 | 30 | void Arguments::split(char* line, char** args) 31 | { 32 | char* pTmp = strchr(line, ' '); 33 | 34 | if (pTmp != nullptr) { 35 | *pTmp = '\0'; 36 | pTmp++; 37 | while (((*pTmp) != 0) && (*pTmp == ' ')) { 38 | pTmp++; 39 | } 40 | if (*pTmp == '\0') { 41 | pTmp = nullptr; 42 | } 43 | } 44 | *args = pTmp; 45 | } 46 | 47 | void Arguments::parse(char* azParam, 48 | int* argc, 49 | char** argv) 50 | { 51 | char* pNext = azParam; 52 | size_t i; 53 | int j; 54 | int quoted = 0; 55 | size_t len = strlen(azParam); 56 | 57 | // Protect spaces inside quotes, but lose the quotes 58 | for (i = 0; i < len; i++) { 59 | if ((quoted == 0) && ('"' == azParam[i])) { 60 | quoted = 1; 61 | azParam[i] = ' '; 62 | } else if (((quoted) != 0) && ('"' == azParam[i])) { 63 | quoted = 0; 64 | azParam[i] = ' '; 65 | } else if (((quoted) != 0) && (' ' == azParam[i])) { 66 | azParam[i] = '\1'; 67 | } 68 | } 69 | 70 | // init 71 | memset(argv, 0x00, sizeof(char*) * C_MAXARGS); 72 | *argc = 1; 73 | argv[0] = azParam; 74 | 75 | while ((nullptr != pNext) && (*argc < C_MAXARGS)) { 76 | split(pNext, &(argv[*argc])); 77 | pNext = argv[*argc]; 78 | 79 | if (nullptr != argv[*argc]) { 80 | *argc += 1; 81 | } 82 | } 83 | 84 | for (j = 0; j < *argc; j++) { 85 | len = strlen(argv[j]); 86 | for (i = 0; i < len; i++) { 87 | if ('\1' == argv[j][i]) { 88 | argv[j][i] = ' '; 89 | } 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/robottestingframework/src/FixtureManager.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | using namespace robottestingframework; 29 | using namespace std; 30 | 31 | FixtureManager::FixtureManager(std::string param) : 32 | dispatcher(nullptr), param(std::move(param)) 33 | { 34 | } 35 | 36 | 37 | FixtureManager::FixtureManager(FixtureEvents* dispatcher, 38 | string param) : 39 | dispatcher(dispatcher), 40 | param(std::move(param)) 41 | { 42 | } 43 | 44 | FixtureManager::~FixtureManager() = default; 45 | 46 | bool FixtureManager::setup() 47 | { 48 | char* szenv = new char[param.size() + 1]; 49 | strcpy(szenv, param.c_str()); 50 | int argc = 0; 51 | char** argv = new char*[128]; // maximum 128 52 | Arguments::parse(szenv, &argc, argv); 53 | argv[argc] = nullptr; 54 | bool ret = setup(argc, argv); 55 | delete[] szenv; 56 | delete[] argv; 57 | return ret; 58 | } 59 | 60 | bool FixtureManager::setup(int argc, char** argv) 61 | { 62 | return true; 63 | } 64 | 65 | 66 | void FixtureManager::tearDown() 67 | { 68 | } 69 | 70 | 71 | bool FixtureManager::check() 72 | { 73 | return true; 74 | } 75 | 76 | 77 | void FixtureManager::setDispatcher(FixtureEvents* dispatcher) 78 | { 79 | this->dispatcher = dispatcher; 80 | } 81 | 82 | 83 | FixtureEvents* FixtureManager::getDispatcher() 84 | { 85 | return dispatcher; 86 | } 87 | 88 | 89 | void FixtureManager::setParam(const std::string param) 90 | { 91 | this->param = param; 92 | } 93 | 94 | std::string FixtureManager::getParam() 95 | { 96 | return param; 97 | } 98 | -------------------------------------------------------------------------------- /src/robottestingframework/src/TestMessage.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | 24 | using namespace robottestingframework; 25 | 26 | 27 | TestMessage::TestMessage() : 28 | strFileName(""), lineNumber(0) 29 | { 30 | } 31 | 32 | 33 | TestMessage::TestMessage(const TestMessage& other) 34 | { 35 | *this = other; 36 | } 37 | 38 | TestMessage::TestMessage(const std::string msg, 39 | const std::string filename, 40 | unsigned int line) 41 | { 42 | strMessage = msg; 43 | strFileName = filename; 44 | lineNumber = line; 45 | } 46 | 47 | TestMessage::TestMessage(const std::string msg, 48 | const std::string detail, 49 | const std::string filename, 50 | unsigned int line) 51 | { 52 | strMessage = msg; 53 | strDetail = detail; 54 | strFileName = filename; 55 | lineNumber = line; 56 | } 57 | 58 | TestMessage::~TestMessage() = default; 59 | 60 | 61 | void TestMessage::setMessage(const std::string message) 62 | { 63 | strMessage = message; 64 | } 65 | 66 | 67 | void TestMessage::setDetail(const std::string detail) 68 | { 69 | strDetail = detail; 70 | } 71 | 72 | std::string TestMessage::getMessage() 73 | { 74 | return strMessage; 75 | } 76 | 77 | std::string TestMessage::getDetail() 78 | { 79 | return strDetail; 80 | } 81 | 82 | 83 | void TestMessage::setSourceLineNumber(unsigned int line) 84 | { 85 | lineNumber = line; 86 | } 87 | 88 | 89 | unsigned int TestMessage::getSourceLineNumber() 90 | { 91 | return lineNumber; 92 | } 93 | 94 | 95 | void TestMessage::setSourceFileName(const std::string filename) 96 | { 97 | strFileName = filename; 98 | } 99 | 100 | std::string TestMessage::getSourceFileName() 101 | { 102 | return strFileName; 103 | } 104 | 105 | void TestMessage::clear() 106 | { 107 | lineNumber = 0; 108 | strFileName.clear(); 109 | strMessage.clear(); 110 | strDetail.clear(); 111 | } 112 | -------------------------------------------------------------------------------- /src/robottestingframework/src/TestResult.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | 24 | using namespace robottestingframework; 25 | 26 | #define CALL_LISTENERS(method, ...) \ 27 | for (const auto& listener : listeners) \ 28 | listener->method(__VA_ARGS__); 29 | 30 | TestResult::TestResult() = default; 31 | 32 | 33 | TestResult::~TestResult() 34 | { 35 | reset(); 36 | } 37 | 38 | 39 | void TestResult::addListener(TestListener* listener) 40 | { 41 | listeners.insert(listener); 42 | } 43 | 44 | 45 | void TestResult::removeListener(TestListener* listener) 46 | { 47 | listeners.erase(listener); 48 | } 49 | 50 | 51 | void TestResult::reset() 52 | { 53 | listeners.clear(); 54 | } 55 | 56 | void TestResult::addReport(const Test* test, TestMessage msg) 57 | { 58 | CALL_LISTENERS(addReport, test, msg); 59 | } 60 | 61 | void TestResult::addError(const Test* test, TestMessage msg) 62 | { 63 | CALL_LISTENERS(addError, test, msg); 64 | } 65 | 66 | void TestResult::addFailure(const Test* test, TestMessage msg) 67 | { 68 | CALL_LISTENERS(addFailure, test, msg); 69 | } 70 | 71 | void TestResult::startTest(const Test* test) 72 | { 73 | CALL_LISTENERS(startTest, test); 74 | } 75 | 76 | void TestResult::endTest(const Test* test) 77 | { 78 | CALL_LISTENERS(endTest, test); 79 | } 80 | 81 | void TestResult::startTestSuite(const Test* test) 82 | { 83 | CALL_LISTENERS(startTestSuite, test); 84 | } 85 | 86 | void TestResult::endTestSuite(const Test* test) 87 | { 88 | CALL_LISTENERS(endTestSuite, test); 89 | } 90 | 91 | void TestResult::startTestRunner() 92 | { 93 | CALL_LISTENERS(startTestRunner); 94 | } 95 | 96 | void TestResult::endTestRunner() 97 | { 98 | CALL_LISTENERS(endTestRunner); 99 | } 100 | -------------------------------------------------------------------------------- /src/robottestingframework/src/TestRunner.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | 24 | #include 25 | 26 | using namespace robottestingframework; 27 | 28 | 29 | TestRunner::TestRunner() : 30 | current(nullptr) 31 | { 32 | } 33 | 34 | 35 | TestRunner::~TestRunner() 36 | { 37 | reset(); 38 | } 39 | 40 | 41 | void TestRunner::addTest(Test* test) 42 | { 43 | if (std::find(tests.begin(), tests.end(), test) == tests.end()) { 44 | tests.push_back(test); 45 | } 46 | } 47 | 48 | 49 | void TestRunner::removeTest(Test* test) 50 | { 51 | for (size_t i = 0; i < tests.size(); i++) { 52 | tests.erase(tests.begin() + i); 53 | } 54 | } 55 | 56 | void TestRunner::reset() 57 | { 58 | tests.clear(); 59 | } 60 | 61 | 62 | void TestRunner::run(TestResult& result) 63 | { 64 | interrupted = false; 65 | result.startTestRunner(); 66 | for (auto& test : tests) { 67 | if (interrupted) { 68 | break; 69 | } 70 | current = test; 71 | test->run(result); 72 | } 73 | result.endTestRunner(); 74 | current = nullptr; 75 | } 76 | 77 | void TestRunner::interrupt() 78 | { 79 | if (current != nullptr) { 80 | current->interrupt(); 81 | } 82 | interrupted = true; 83 | } 84 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | # build tests 21 | include(RobotTestingFrameworkTestHelpers) 22 | 23 | if (BUILD_TESTING) 24 | # enable Robot Testing Framework testing 25 | enable_robottestingframework_tests() 26 | 27 | # adding api c++ tests 28 | add_subdirectory(api) 29 | 30 | if (BUILD_TESTRUNNER) 31 | # adding basic tests 32 | add_subdirectory(basic) 33 | 34 | # adding basic tests 35 | add_subdirectory(fixture) 36 | 37 | # adding lua tests 38 | add_subdirectory(lua) 39 | 40 | # adding python tests 41 | add_subdirectory(python) 42 | 43 | # adding python tests 44 | add_subdirectory(ruby) 45 | 46 | # adding robottestingframework-testrunner tests 47 | add_subdirectory(robottestingframework-testrunner) 48 | 49 | # adding robottestingframework_add_suite tests 50 | add_subdirectory(robottestingframework_add_suite) 51 | endif() 52 | 53 | add_subdirectory(misc) 54 | endif() 55 | -------------------------------------------------------------------------------- /tests/api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | # AsserterTest 21 | add_cpptest(NAME VocabTest SRCS VocabTest.cpp) 22 | 23 | # ExceptionsTest 24 | add_cpptest(NAME ExceptionsTest SRCS ExceptionsTest.cpp) 25 | 26 | # AsserterTest 27 | add_cpptest(NAME AsserterTest SRCS AsserterTest.cpp) 28 | -------------------------------------------------------------------------------- /tests/api/VocabTest.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | using namespace robottestingframework; 30 | using namespace shlibpp; 31 | 32 | class MyTest : public TestCase 33 | { 34 | public: 35 | MyTest() : 36 | TestCase("VocabTest") 37 | { 38 | } 39 | 40 | void run() override 41 | { 42 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(Vocab::encode("RTF") == (int)4609106, "checking Vocab::encode()"); 43 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(Vocab::decode(Vocab::encode("RRTF")) == "RRTF", "checking Vocab::decode()"); 44 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(Vocab::decode(VOCAB('R', 'T')) == "RT", "checking VOCAB"); 45 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(Vocab::decode(VOCAB('R', 'T', 'F')) == "RTF", "checking VOCAB"); 46 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(Vocab::decode(VOCAB('R', 'T', 'F', 'R')) == "RTFR", "checking VOCAB"); 47 | } 48 | }; 49 | 50 | 51 | int main(int argc, char** argv) 52 | { 53 | ConsoleListener listener; 54 | TestResultCollector collector; 55 | TestResult result; 56 | result.addListener(&listener); 57 | result.addListener(&collector); 58 | 59 | MyTest test; 60 | test.TestCase::run(result); 61 | return collector.failedCount(); 62 | } 63 | -------------------------------------------------------------------------------- /tests/basic/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | if(ENABLE_PLUGIN) 21 | # SingleTestCase 22 | add_robottestingframework_cpptest(NAME SingleTestCase SRCS SingleTestCase.cpp) 23 | 24 | # SingleTestCase 25 | add_robottestingframework_cpptest(NAME MultiTestCases SRCS MultiTestCases.cpp) 26 | 27 | # SingleTestSuite 28 | add_robottestingframework_cpptest(NAME SingleTestSuite SRCS SingleTestSuite.cpp) 29 | 30 | # SingleTestSuite 31 | add_robottestingframework_cpptest(NAME FixtureManager SRCS FixtureManager.cpp) 32 | 33 | if (UNIX) 34 | # WebProgListener 35 | add_robottestingframework_cpptest(NAME WebProgListener SRCS WebProgListener.cpp) 36 | endif (UNIX) 37 | endif() 38 | 39 | -------------------------------------------------------------------------------- /tests/basic/MultiTestCases.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | using namespace robottestingframework; 28 | 29 | 30 | class MyTest : public TestCase 31 | { 32 | public: 33 | MyTest() : 34 | TestCase("MyTest") 35 | { 36 | } 37 | 38 | void run() override 39 | { 40 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(2 < 3, "two is less than three"); 41 | } 42 | }; 43 | 44 | 45 | class MyTest2 : public TestCase 46 | { 47 | public: 48 | MyTest2() : 49 | TestCase("MyTest") 50 | { 51 | } 52 | 53 | void run() override 54 | { 55 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(2 == 3, "two is equal to three"); 56 | } 57 | }; 58 | 59 | 60 | class MultiTestCases : public TestCase 61 | { 62 | public: 63 | MultiTestCases() : 64 | TestCase("MultiTestCases") 65 | { 66 | } 67 | 68 | void run() override 69 | { 70 | TestResultCollector collector; 71 | 72 | // create a test result and add the listeners 73 | TestResult result; 74 | result.addListener(&collector); 75 | 76 | // create a test runner 77 | TestRunner runner; 78 | MyTest test1; 79 | MyTest2 test2; 80 | runner.addTest(&test1); 81 | runner.addTest(&test2); 82 | runner.run(result); 83 | 84 | //ROBOTTESTINGFRAMEWORK_TEST_REPORT(Asserter::format("count: %d", collector.failedCount())); 85 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(collector.testCount() == 2, "Checking tests count"); 86 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(collector.passedCount() == 1, "Checking passed count"); 87 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(collector.failedCount() == 1, "Checking failed count"); 88 | } 89 | }; 90 | 91 | ROBOTTESTINGFRAMEWORK_PREPARE_PLUGIN(MultiTestCases) 92 | -------------------------------------------------------------------------------- /tests/basic/SingleTestCase.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | #include 24 | #include 25 | 26 | using namespace robottestingframework; 27 | 28 | 29 | class MyTest : public TestCase 30 | { 31 | public: 32 | MyTest() : 33 | TestCase("MyTest") 34 | { 35 | } 36 | 37 | void run() override 38 | { 39 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(2 < 3, "two is less than three"); 40 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(2 == 3, "two is equal to three"); 41 | } 42 | }; 43 | 44 | 45 | class SingleTestCase : public TestCase 46 | { 47 | public: 48 | SingleTestCase() : 49 | TestCase("SingleTestCase") 50 | { 51 | } 52 | 53 | void run() override 54 | { 55 | TestResultCollector collector; 56 | 57 | // create a test result and add the listeners 58 | TestResult result; 59 | result.addListener(&collector); 60 | 61 | // calling a test case 62 | MyTest atest; 63 | atest.TestCase::run(result); 64 | 65 | //ROBOTTESTINGFRAMEWORK_TEST_REPORT(Asserter::format("count: %d", collector.failedCount())); 66 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(collector.passedCount() == 0, "Checking passed count"); 67 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(collector.failedCount() == 1, "Checking failed count"); 68 | } 69 | }; 70 | 71 | ROBOTTESTINGFRAMEWORK_PREPARE_PLUGIN(SingleTestCase) 72 | -------------------------------------------------------------------------------- /tests/fixture/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | if (ENABLE_PLUGIN) 21 | # Build a ficture plugin 22 | set(CMAKE_SHARED_MODULE_PREFIX "") 23 | add_library(myfixture MODULE MyFixManager.cpp MyFixManager.h) 24 | target_link_libraries(myfixture RobotTestingFramework::RTF 25 | RobotTestingFramework::RTF_dll) 26 | 27 | # add the FixturePluginLoader test 28 | 29 | add_robottestingframework_cpptest(NAME FixturePluginLoader 30 | SRCS FixturePluginLoader.cpp 31 | PARAM "$") 32 | endif() 33 | -------------------------------------------------------------------------------- /tests/fixture/MyFixManager.cpp: -------------------------------------------------------------------------------- 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 | #include "MyFixManager.h" 23 | #include 24 | #include 25 | 26 | #include 27 | #include 28 | 29 | using namespace std; 30 | using namespace robottestingframework; 31 | 32 | ROBOTTESTINGFRAMEWORK_PREPARE_FIXTURE_PLUGIN(MyFixManager) 33 | 34 | bool MyFixManager::setup(int argc, char** argv) 35 | { 36 | ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(argc >= 1, "missing paramter MY_FIXTURE_TEST_PARAM"); 37 | ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(string(argv[0]) == string("MY_FIXTURE_TEST_PARAM"), "missing paramter MY_FIXTURE_TEST_PARAM"); 38 | ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(putenv((char*)"MY_FIXTURE_TEST_SETUP=OK") == 0, "cannot set env variable MY_FIXTURE_TEST_SETUP"); 39 | return true; 40 | } 41 | 42 | bool MyFixManager::check() 43 | { 44 | ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(putenv((char*)"MY_FIXTURE_TEST_CHECK=OK") == 0, "cannot set env variable MY_FIXTURE_TEST_CHECK"); 45 | return true; 46 | } 47 | 48 | void MyFixManager::tearDown() 49 | { 50 | getDispatcher()->fixtureCollapsed(TestMessage("COLAPSED")); 51 | ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(putenv((char*)"MY_FIXTURE_TEST_TEARDOWN=OK") == 0, "cannot set env variable MY_FIXTURE_TEST_TEARDOWN"); 52 | } 53 | 54 | MyFixManager::~MyFixManager() 55 | { 56 | // ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(putenv("MY_FIXTURE_TEST_DELETE=OK") == 0, "cannot set env variable MY_FIXTURE_TEST_DELETE"); 57 | } 58 | -------------------------------------------------------------------------------- /tests/fixture/MyFixManager.h: -------------------------------------------------------------------------------- 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_MYFIXMANAGER_H 23 | #define ROBOTTESTINGFRAMEWORK_MYFIXMANAGER_H 24 | 25 | #include 26 | 27 | class MyFixManager : public robottestingframework::FixtureManager 28 | { 29 | public: 30 | MyFixManager() 31 | { 32 | } 33 | ~MyFixManager() override; 34 | 35 | bool setup(int argc, char** argv) override; 36 | 37 | bool check() override; 38 | 39 | void tearDown() override; 40 | }; 41 | 42 | #endif // ROBOTTESTINGFRAMEWORK_MYFIXMANAGER_H 43 | -------------------------------------------------------------------------------- /tests/lua/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | # adding lua tests 21 | if(ENABLE_LUA_PLUGIN) 22 | 23 | # LuaPlugin depends on LuaTestCase.lua 24 | add_robottestingframework_cpptest(NAME LuaPlugin 25 | SRCS LuaPlugin.cpp 26 | PARAM "${TEST_TARGET_PATH}/LuaTestCase.lua" 27 | ENV "bar") 28 | 29 | # LuaTestCase 30 | add_robottestingframework_luatest(LuaTestCase.lua) 31 | 32 | endif() 33 | 34 | -------------------------------------------------------------------------------- /tests/lua/LuaPlugin.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | using namespace robottestingframework; 29 | using namespace robottestingframework::plugin; 30 | 31 | class LuaPlugin : public TestCase 32 | { 33 | private: 34 | LuaPluginLoader loader; 35 | TestCase* test; 36 | 37 | public: 38 | LuaPlugin() : 39 | TestCase("LuaPlugin") 40 | { 41 | } 42 | 43 | bool setup(int argc, char** argv) override 44 | { 45 | ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(argc >= 2, "Missing lua test file as argument"); 46 | ROBOTTESTINGFRAMEWORK_TEST_REPORT(Asserter::format("Loading lua file %s", argv[1])); 47 | test = loader.open(argv[1]); 48 | ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(test != nullptr, Asserter::format("Cannot load %s", argv[1])); 49 | return true; 50 | } 51 | 52 | void run() override 53 | { 54 | 55 | TestResultCollector collector; 56 | 57 | // create a test result and add the listeners 58 | TestResult result; 59 | result.addListener(&collector); 60 | 61 | // calling a test case 62 | test->run(result); 63 | 64 | //ROBOTTESTINGFRAMEWORK_TEST_REPORT(Asserter::format("count: %d", collector.failedCount())); 65 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(collector.passedCount() == 1, "Checking passed count"); 66 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(collector.failedCount() == 0, "Checking failed count"); 67 | } 68 | }; 69 | 70 | ROBOTTESTINGFRAMEWORK_PREPARE_PLUGIN(LuaPlugin) 71 | -------------------------------------------------------------------------------- /tests/lua/LuaTestCase.lua: -------------------------------------------------------------------------------- 1 | -- Robot Testing Framework 2 | -- 3 | -- Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | -- 5 | -- This library is free software; you can redistribute it and/or 6 | -- modify it under the terms of the GNU Lesser General Public 7 | -- License as published by the Free Software Foundation; either 8 | -- version 2.1 of the License, or (at your option) any later version. 9 | -- 10 | -- This library is distributed in the hope that it will be useful, 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | -- Lesser General Public License for more details. 14 | -- 15 | -- You should have received a copy of the GNU Lesser General Public 16 | -- License along with this library; if not, write to the Free Software 17 | -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | -- 20 | -- The TestCase table is used by the lua plugin loader 21 | -- to invoke the corresponding methods: 22 | -- 23 | -- TestCase.setup = function(options) ... return true end 24 | -- TestCase.run = function() ... end 25 | -- TestCase.tearDown = function() ... end 26 | -- 27 | -- The following methods are for reporting, failures or assertions: 28 | -- 29 | -- robottestingframework.setName(name) : sets the test name (defualt is the test filename) 30 | -- robottestingframework.testReport(msg) : reports a informative message 31 | -- robottestingframework.testCheck(condition, msg) : reports the test message and marks the test as failed if condition is false 32 | -- robottestingframework.testFailIf(condition, msg) : marks the test as failed and reports failure message (the reason) if condition is false 33 | -- robottestingframework.assertError(msg) : throws an error exception with message 34 | -- robottestingframework.asserFail(msg) : throws a failure exception with message 35 | -- robottestingframework.getEnvironment() : returns the test environment params 36 | -- 37 | 38 | -- 39 | -- setup is called before the test's run to setup 40 | -- the user defined fixture 41 | -- @return Boolean (true/false uppon success or failure) 42 | -- 43 | TestCase.setup = function(parameter) 44 | robottestingframework.setName("LuaTestCase") 45 | return true; 46 | end 47 | 48 | -- 49 | -- The implementation of the test goes here 50 | -- 51 | TestCase.run = function() 52 | robottestingframework.testCheck(5>3, "Cheking robottestingframework.testCheck") 53 | robottestingframework.testReport("Cheking robottestingframework.testFailIf") 54 | robottestingframework.testFailIf(true, "testFailIf") 55 | end 56 | 57 | 58 | -- 59 | -- tearDown is called after the test's run to tear down 60 | -- the user defined fixture 61 | -- 62 | TestCase.tearDown = function() 63 | end 64 | -------------------------------------------------------------------------------- /tests/misc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | find_package(Perl QUIET) 20 | if(PERL_FOUND) 21 | add_test(NAME misc::check_license 22 | COMMAND "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/check_license.pl" 23 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") 24 | endif() 25 | -------------------------------------------------------------------------------- /tests/misc/check_license_skip.txt: -------------------------------------------------------------------------------- 1 | .appveyor.yml 2 | .clang-format 3 | .coveralls.yml 4 | .gitignore 5 | .mailmap 6 | .travis.yml 7 | LICENSE 8 | README.md 9 | cmake/AddInstallRPATHSupport.cmake 10 | cmake/AddUninstallTarget.cmake 11 | cmake/CMakePackageConfigHelpers.cmake 12 | cmake/CodeCoverage.cmake 13 | cmake/ExtractVersion.cmake 14 | cmake/FindTinyXML.cmake 15 | cmake/InstallBasicPackageFiles.cmake 16 | cmake/ReplaceImportedTargets.cmake 17 | cmake/StandardFindModule.cmake 18 | cmake/WriteBasicConfigVersionFile.cmake 19 | cmake/doxygen/Doxyfile.part.template 20 | doc/release/v1_4_0.md 21 | doc/release/v1_4_1.md 22 | doc/release/v1_6_0.md 23 | doc/release/v1_6_1.md 24 | doc/release/v2_0_0.md 25 | doc/release/v2_0_1.md 26 | doc/release/v2_0_2.md 27 | doc/robottestingframework.png 28 | doc/robottestingframework.svg 29 | doc/robottestingframework_arch.png 30 | examples/ada-plugin/README.md 31 | examples/testrunner/mysuite.xml 32 | extern/mongoose/src/mongoose.c 33 | extern/mongoose/src/mongoose.h 34 | extern/tinyxml/src/changes.txt 35 | extern/tinyxml/src/readme.txt 36 | extern/tinyxml/src/tinystr.h 37 | extern/tinyxml/src/tinyxml.cpp 38 | extern/tinyxml/src/tinyxml.h 39 | extern/tinyxml/src/tinyxmlerror.cpp 40 | extern/tinyxml/src/tinyxmlparser.cpp 41 | src/plugins/ada/README.md 42 | src/robottestingframework-testrunner/include/cmdline.h 43 | tests/misc/check_license_skip.txt 44 | tests/robottestingframework-testrunner/testsuite.xml 45 | -------------------------------------------------------------------------------- /tests/python/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | # adding python tests 21 | if(ENABLE_PYTHON_PLUGIN) 22 | 23 | # PythonPlugin depends on PythonTestCase.py 24 | add_robottestingframework_cpptest(NAME PythonPlugin 25 | SRCS PythonPlugin.cpp 26 | PARAM "${TEST_TARGET_PATH}/PythonTestCase.py" 27 | ENV "bar") 28 | 29 | # LuaTestCase 30 | add_robottestingframework_pythontest(PythonTestCase.py) 31 | 32 | endif() 33 | 34 | -------------------------------------------------------------------------------- /tests/python/PythonPlugin.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | using namespace robottestingframework; 29 | using namespace robottestingframework::plugin; 30 | 31 | class PythonPlugin : public TestCase 32 | { 33 | private: 34 | PythonPluginLoader loader; 35 | TestCase* test; 36 | 37 | public: 38 | PythonPlugin() : 39 | TestCase("PythonPlugin") 40 | { 41 | } 42 | 43 | bool setup(int argc, char** argv) override 44 | { 45 | ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(argc >= 2, "Missing python test file as argument"); 46 | ROBOTTESTINGFRAMEWORK_TEST_REPORT(Asserter::format("Loading python file %s", argv[1])); 47 | test = loader.open(argv[1]); 48 | ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(test != nullptr, Asserter::format("Cannot load %s", argv[1])); 49 | return true; 50 | } 51 | 52 | void run() override 53 | { 54 | 55 | TestResultCollector collector; 56 | 57 | // create a test result and add the listeners 58 | TestResult result; 59 | result.addListener(&collector); 60 | 61 | // calling a test case 62 | test->run(result); 63 | 64 | //ROBOTTESTINGFRAMEWORK_TEST_REPORT(Asserter::format("count: %d", collector.failedCount())); 65 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(collector.passedCount() == 1, "Checking passed count"); 66 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(collector.failedCount() == 0, "Checking failed count"); 67 | } 68 | }; 69 | 70 | ROBOTTESTINGFRAMEWORK_PREPARE_PLUGIN(PythonPlugin) 71 | -------------------------------------------------------------------------------- /tests/python/PythonTestCase.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Robot Testing Framework 4 | # 5 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 6 | # 7 | # This library is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU Lesser General Public 9 | # License as published by the Free Software Foundation; either 10 | # version 2.1 of the License, or (at your option) any later version. 11 | # 12 | # This library is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public 18 | # License along with this library; if not, write to the Free Software 19 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | 21 | ''' 22 | robottestingframework module is automatically imported by the python plugin loader 23 | to invoke the corresponding test case methods. To develop a new 24 | test case simply implement the following class; (setup and tearDown 25 | methods are optional) : 26 | 27 | class TestCase: 28 | def setup(self, param): 29 | return True 30 | 31 | def run(self): 32 | 33 | def tearDown(self): 34 | 35 | 36 | The following methods are for reporting, failure or assertions: 37 | 38 | robottestingframework.setName(name) : sets the test name (defualt is the test filename) 39 | robottestingframework.testReport(msg) : reports a informative message 40 | robottestingframework.testCheck(condition, msg) : reports the test message and marks the test as failed if condition is false 41 | robottestingframework.assertError(msg) : throws an error exception with message 42 | robottestingframework.asserFail(msg) : throws a failure exception with message 43 | ''' 44 | 45 | class TestCase: 46 | # setup is called before the test's run to setup 47 | # the user defined fixture 48 | # @return Boolean (True/False uppon success or failure) 49 | def setup(self, param): 50 | robottestingframework.setName("PythonTestCase") 51 | return True 52 | 53 | # The implementation of the test goes here 54 | def run(self): 55 | robottestingframework.testCheck(5>3, "Cheking robottestingframework.testCheck") 56 | robottestingframework.testReport("Cheking robottestingframework.Report") 57 | #robottestingframework.testFailIf(, "testFailIf") 58 | 59 | # tearDown is called after the test's run to tear down 60 | # the user defined fixture 61 | def tearDown(self): 62 | pass 63 | -------------------------------------------------------------------------------- /tests/robottestingframework-testrunner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | # adding robottestingframework-testrunner tests 21 | add_test(NAME TestRunnerLoadSimpleSuite 22 | COMMAND $ -v --no-output --suite ${CMAKE_CURRENT_SOURCE_DIR}/testsuite.xml 23 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) 24 | -------------------------------------------------------------------------------- /tests/robottestingframework-testrunner/testsuite.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | a simple test suite 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /tests/robottestingframework_add_suite/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | # Prepare 'build_generator', 'build_options' and 'build_module_path' variables 21 | # for tests in subdirectories 22 | set(build_generator --build-generator "${CMAKE_GENERATOR}") 23 | if(CMAKE_GENERATOR_PLATFORM) 24 | list(APPEND build_generator --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}") 25 | endif() 26 | if(CMAKE_GENERATOR_TOOLSET) 27 | list(APPEND build_generator --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}") 28 | endif() 29 | if(CMAKE_CONFIGURATION_TYPES) 30 | list(APPEND build_generator --build-config $) 31 | endif() 32 | 33 | unset(build_options) 34 | if(CMAKE_BUILD_TYPE) 35 | list(APPEND build_options -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}) 36 | endif() 37 | 38 | # Use only if cmake modules not installed by YARP are required by the test 39 | set(build_module_path -DCMAKE_MODULE_PATH="${CMAKE_MODULE_PATH}") 40 | string(REPLACE ";" "\;" build_module_path "${build_module_path}") 41 | 42 | 43 | add_test(NAME robottestingframework_add_suite_test 44 | COMMAND ${CMAKE_CTEST_COMMAND} --build-and-test "${CMAKE_CURRENT_SOURCE_DIR}/demo" 45 | "${CMAKE_CURRENT_BINARY_DIR}/demo" 46 | --build-two-config 47 | ${build_generator} 48 | --build-project robottestingframework_add_suite_demo 49 | --build-options ${build_options} 50 | ${build_module_path} 51 | -DRobotTestingFramework_DIR=${CMAKE_BINARY_DIR} 52 | --test-command ${CMAKE_CTEST_COMMAND} ${build_generator} 53 | WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") 54 | 55 | # Cleanup 56 | add_test(NAME robottestingframework_add_suite_test::cleanup 57 | COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/demo") 58 | set_tests_properties(robottestingframework_add_suite_test::cleanup PROPERTIES FIXTURES_CLEANUP robottestingframework_add_suite_test) 59 | -------------------------------------------------------------------------------- /tests/robottestingframework_add_suite/demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | set(RobotTestingFramework_ADD_SUITE_DEBUG TRUE) 21 | cmake_minimum_required(VERSION 3.5) 22 | project(robottestingframework_add_suite_demo) 23 | enable_testing() 24 | 25 | find_package(RobotTestingFramework REQUIRED) 26 | 27 | robottestingframework_add_plugin(demo_fixturemanager SOURCES demo_fixturemanager.cpp) 28 | target_link_libraries(demo_fixturemanager RobotTestingFramework::RTF 29 | RobotTestingFramework::RTF_dll) 30 | 31 | robottestingframework_add_plugin(demo_testcase SOURCES demo_testcase.cpp) 32 | target_link_libraries(demo_testcase RobotTestingFramework::RTF 33 | RobotTestingFramework::RTF_dll) 34 | 35 | robottestingframework_add_suite(NAME demo 36 | RobotTestingFramework_FIXTURE demo_fixturemanager 37 | RobotTestingFramework_TEST demo_testcase TYPE dll 38 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 39 | WEB_REPORTER 40 | WEB_PORT 2020) 41 | -------------------------------------------------------------------------------- /tests/robottestingframework_add_suite/demo/demo_fixturemanager.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | #include 24 | 25 | class DemoFixtureManager : public robottestingframework::FixtureManager 26 | { 27 | public: 28 | DemoFixtureManager() {}; 29 | 30 | bool setup(int argc, char** argv) override 31 | { 32 | return true; 33 | } 34 | 35 | bool check() override 36 | { 37 | return true; 38 | } 39 | 40 | void tearDown() override 41 | { 42 | } 43 | }; 44 | 45 | ROBOTTESTINGFRAMEWORK_PREPARE_FIXTURE_PLUGIN(DemoFixtureManager) 46 | -------------------------------------------------------------------------------- /tests/robottestingframework_add_suite/demo/demo_testcase.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | #include 24 | #include 25 | 26 | class DemoTestCase : public robottestingframework::TestCase 27 | { 28 | public: 29 | DemoTestCase() : 30 | TestCase("DemoTestCase") 31 | { 32 | } 33 | 34 | void run() override 35 | { 36 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(2 < 3, "two is less than three"); 37 | } 38 | }; 39 | 40 | ROBOTTESTINGFRAMEWORK_PREPARE_PLUGIN(DemoTestCase) 41 | -------------------------------------------------------------------------------- /tests/ruby/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Robot Testing Framework 2 | # 3 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | 20 | # adding ruby tests 21 | if(ENABLE_RUBY_PLUGIN) 22 | 23 | # RubyPlugin depends on RubyTestCase.rb 24 | add_robottestingframework_cpptest(NAME RubyPlugin 25 | SRCS RubyPlugin.cpp 26 | PARAM "${TEST_TARGET_PATH}/RubyTestCase.rb" 27 | ENV "bar") 28 | 29 | # LuaTestCase 30 | add_robottestingframework_rubytest(RubyTestCase.rb) 31 | 32 | endif() 33 | -------------------------------------------------------------------------------- /tests/ruby/RubyPlugin.cpp: -------------------------------------------------------------------------------- 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 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | using namespace robottestingframework; 29 | using namespace robottestingframework::plugin; 30 | 31 | class RubyPlugin : public TestCase 32 | { 33 | private: 34 | RubyPluginLoader loader; 35 | TestCase* test; 36 | 37 | public: 38 | RubyPlugin() : 39 | TestCase("RubyPlugin") 40 | { 41 | } 42 | 43 | bool setup(int argc, char** argv) override 44 | { 45 | ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(argc >= 2, "Missing ruby test file as argument"); 46 | ROBOTTESTINGFRAMEWORK_TEST_REPORT(Asserter::format("Loading ruby file %s", argv[1])); 47 | test = loader.open(argv[1]); 48 | ROBOTTESTINGFRAMEWORK_ASSERT_ERROR_IF_FALSE(test != nullptr, Asserter::format("Cannot load %s", argv[1])); 49 | return true; 50 | } 51 | 52 | void run() override 53 | { 54 | 55 | TestResultCollector collector; 56 | 57 | // create a test result and add the listeners 58 | TestResult result; 59 | result.addListener(&collector); 60 | 61 | // calling a test case 62 | test->run(result); 63 | 64 | //ROBOTTESTINGFRAMEWORK_TEST_REPORT(Asserter::format("count: %d", collector.failedCount())); 65 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(collector.passedCount() == 1, "Checking passed count"); 66 | ROBOTTESTINGFRAMEWORK_TEST_CHECK(collector.failedCount() == 0, "Checking failed count"); 67 | } 68 | }; 69 | 70 | ROBOTTESTINGFRAMEWORK_PREPARE_PLUGIN(RubyPlugin) 71 | -------------------------------------------------------------------------------- /tests/ruby/RubyTestCase.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | 3 | # Robot Testing Framework 4 | # 5 | # Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT) 6 | # 7 | # This library is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU Lesser General Public 9 | # License as published by the Free Software Foundation; either 10 | # version 2.1 of the License, or (at your option) any later version. 11 | # 12 | # This library is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public 18 | # License along with this library; if not, write to the Free Software 19 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | 21 | # RobotTestingFramework module is automatically imported by the ruby plugin loader 22 | # to invoke the corresponding test case methods. To develop a new 23 | # test case simply implement the following class; (setup and tearDown 24 | # methods are optional) : 25 | # 26 | # class TestCase 27 | # def setup(param) 28 | # ... 29 | # return true 30 | # end 31 | # 32 | # def run ... end 33 | # 34 | # def tearDown ... end 35 | # end 36 | # 37 | # The following methods are for reporting, failure or assertions: 38 | # 39 | # RobotTestingFramework::setName(name) : sets the test name (defualt is the test filename) 40 | # RobotTestingFramework::testReport(msg) : reports a informative message 41 | # RobotTestingFramework::testCheck(condition, msg) : reports the test message and marks the test as failed if condition is false 42 | # RobotTestingFramework::assertError(msg) : throws an error exception with message 43 | # RobotTestingFramework::asserFail(msg) : throws a failure exception with message 44 | # 45 | 46 | class TestCase 47 | # setup is called before the test's run to setup 48 | # the user defined fixture 49 | # @return Boolean (True/False uppon success or failure) 50 | def setup(param) 51 | RobotTestingFramework::setName("RubyTestCase") 52 | return true 53 | end 54 | 55 | # The implementation of the test goes here 56 | def run 57 | RobotTestingFramework::testCheck(5>3, "Cheking RobotTestingFramework.testCheck") 58 | RobotTestingFramework.testReport("Cheking RobotTestingFramework.testReport") 59 | #RobotTestingFramework.testFailIf(, "testFailIf") 60 | end 61 | 62 | # tearDown is called after the test's run to tear down 63 | # the user defined fixture 64 | def tearDown 65 | end 66 | end 67 | --------------------------------------------------------------------------------