Skip to content

Robot Framework

Shakawath Hossain edited this page Dec 19, 2018 · 59 revisions

Introduction

We use Robot Framework as a tool to test the web app. Currently the test object is the dev stage.

Browser

The web app is tested in the following browsers:

Sauce Build Matrix

Tags

Tags are used to define when and by which browser they are executed.

Used tags:

  • smoketest Tests, which are short and follow important workflows. Used in tests which are run everytime a commit is done.
  • chromeonly Tests, which are longer, but still follow important workflows. Used only in chrome tests which are run everytime a commit is done.
  • firefoxonly Tests, which are longer, but still follow important workflows. Used only in firefox tests which are run everytime a commit is done.
  • noslowpoke Tests, which are part of the smoketests, but would take too much time in browsers IE and edge.

Dependencies

Several tests do not work on their own and depend on several conditions which the metadatamanagement must meet.

  • Public user tests all need the project gra2005 with all the content the graduate panel of 2005 comprises.
  • Tests which create surveys require the project robotproject (without "s" between "robot" and "project"). The project itself must not contain anything.
  • The following survey edit tests require the fileuploadproject: upload_file, check_versioning and check_attachment_versioning. The project needs to contain a survey which is validly filled with every necessary input. Additionaly it has to have exactly one attachment.

Keyword libraries

The following libraries are used:

Special Keywords

There are several keywords that we built and use differently than the standard keywords.

  • Click Element Through Tooltips Firefox had several problems with tooltips as it can't execute properly the keywords Mouse Over and Focus, so there was no possible way to get a tooltip to vanish and make the hidden button available. So a JavaScript-code was written, which is executed. We use them also in Chrome and Edge due to the speed of the keyword in comparison with the standard way.

IDE's

There are some suitable IDE's to write robot tests, e.g. Robot IDE, Pycharm, Eclipse etc. In addition, one could also use a text editor like notepad++ with .robot file extension to develop the robot tests.

  • In our metadatamanagement project to develop Robot tests we have used Pycharm IED with IntelliBot plugins. The IDE is specially designed for python based developers. The IntelliBot plugins leverage the robot keyword based development with proper syntext highlighting.

Set up and Configure IDE

  • Step 1: Check if python already installed on your system In Shell console Type: python –version You should get a version number, else you should install python. In order to run our tests with ExtendedSelenium2Library, we Need Python Version 2.7.x because it is written in Python 2.7. In our project we have installed Python 2.7.14.

    • Set Environment variable for Python: My Computer>>Properties >>Advance System Settings >>Advance Tab >> Environment Variable >> System Variable>> Click on Path Add new variable for Python 2.7.x according to your installation directory. In my case i have installed Python in C drive. C:\Python27 C:\Python27\Scripts

    • Install Robot Framework:

      In Shell Type: pip install robotframework

  • Step 2: This step applicable if we want to use Pycharm DIE with intellibot Plugin.

    • Install Pycharm:

      In this link (https://www.jetbrains.com/pycharm/download/#section=windows), please find the Community Edition Pycharm (free edition) and install it in your machine.

    • Install Intellibot:

      Now start PyCharm and open: File >> Settings >>Plugins>> Marketplace >>Type“Intellibot“ - Press “Install Plugin” button and restart PyCharm.

      • Now Pycharm and Intellibot both are installed to write tests in Robot Framework.
  • Step 3: Set up exact Python Interpreter for the Project. Go to in your Pycharm DIE: File >> Settings >> Project (you are working) >> Project Interpreter>> Select Python 2.7

Run Test in Pycharm:

  • Via Terminal:

    Pycharm comes with embedded terminal. One can write the command and run the Robot Tests.

  • Via Run Configuration:

    In order to run the tests which are needed frequently one can create the run configuration accordingly.

  • Example: Let’s say I want to setup a run configuration for „Chrome Smoketest“.

    • Go to the Pycharm IDE: Run >> Edit Configuration>> Python >> Press „+“ - Give a name of the run configuration e.g. „smoketest_chrome“
    • Give the Script Path to „C:\Python27\Lib\site-packages\robot\run.py“. We need the robot run.py file in the script path.
    • Give the Parameters to „ -d target/test/robotframework/logs -v BROWSER:chrome – include smoketest –exclude firefoxonly ./src/test/robotframework“ according to your project source variable.
    • Set the Python Interpreter to „Python 2.7“since we have set it as the interpreter for our project.
    • Set the working directory to „C:\Users\Hossain\metadatamanagement“. Adjust it according to your project directory.
    • Press Apply and OK. Now, one can find it nearer to the run icon and run it.

Useful links

Robot Framework information every tester should read: