Skip to content

Robot Framework

moellerth edited this page Oct 4, 2022 · 59 revisions

Introduction

We use Robot Framework as a tool to test the web app. Currently the test object is the dev stage. To run tests locally have a look at the README under /src/test/robotframework.

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 testing environment must meet. The common setup process checks if the needed projects (not the concepts) exist.

  • 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.
  • Also needed are the following projects and datasets:
    • the complete cmp2014 project
    • testanalysispackage
    • robotprojectrelease4[BROWSERNAME]
    • robotproject4[BROWSERNAME]
    • conceptproject[BROWSERNAME]
    • concept Roll Back Concept [BROWSER] De with one previous version with the title "Roll Back Concept [BROWSER] De_Rollback"
    • concept Referenced Concept [BROWSER] De, which needs to be referenced in at least one instrument

Temporary test projects

Some tests create test projects that are deleted after execution. Before running the tests there must be no projects with the following names:

  • temprobotcheckaccess[BROWSERNAME]
  • temprobotassignroles[BROWSERNAME]
  • temprobotdeleteroles[BROWSERNAME]
  • atemprobotcheckicons[BROWSERNAME] (needs an a at the beginning because of sorting)
  • tempdatapackage[BROWSERNAME]
  • tempanalysis[BROWSERNAME]

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.

Set up and run Tests

  1. Install python and pip: sudo apt get update sudo apt install python3.8.0 sudo apt install python3-pip

  2. Install ChromeDriver: Download https://chromedriver.chromium.org/ and extract it to .local/bin in your home directory.

  3. Execute the setup.sh file in the directory src/test/roboframework to install the necessary packages.

  4. Start the tests from the command-line with: robot -P ./src/test/robotframework/libs -d target/test/robotframework/logs/chrome -v BROWSER:chrome --include publicuserNOTfirefoxonlyNOTlocalonly ./src/test/robotframework

  5. You can find more test configuration examples in the github workflow defnition file

  6. Useful Parameter

  • -t Select tests by name or by long name. Name is case and space insensitive. E.g. -t CreateAnalysisPackage
  • -s Select test suits by name or by long name. Name is case and space insensitive. E.g. -s analysispackagemanagement
  • -X Exit on failure

Useful links

Installing Python 3 on Linux

Robot Framework information every tester should read: