Beliebte Suchanfragen

Cloud Native

DevOps

IT-Security

Agile Methoden

Java

//

Robot Framework Tutorial 2016 – Installation

8.1.2016 | 7 minutes of reading time

Robot Framework Tutorial 2016

Part 1: Installation
Part 2: Keywords
Part 3: Implementing Keywords in Java
Part 4: Selenium2Library as a drop-in replacement for SeleniumLibrary
Part 5: Integration with TeamCity CI-Server
Part 6: Integration with Jenkins
Part 7: File Processing
Part 8: Working with Collections
Part 9: Wrap-Up and Conclusion

The “old” Robot Framework Tutorial.

Update February 2019: It might be worth looking at this newer blog post that is utilizing Docker to install the Robot Framework:
https://blog.codecentric.de/en/2019/02/running-robot-framework-in-your-own-docker-container/


Preface

Well, if this were a movie then it would probably be called a remake. This is because we have been writing up a – I hope and believe – pretty comprehensive tutorial on the Robot Framework during the last three years . So why start over? There are two main reasons for this:

  1. Even though there are no revolutionary changes in the Robot Framework, it has evolved during this time and that should be reflected in the new series.
  2. And of course we have learned new things and made new experiences with respect to the framework and overall testing approaches. That is also something that will be incorporated into this new guide.

Ok, enough with the preface. Let’s robot :-).

Robot Framework Fast Forward

Let’s take a very quick tour on the Robot Framework . This is important to get a better understanding on the installation procedure of the framework as described in this blog post. Of course I could have pointed to some older posts for this overview, but I would like to have this blog post self-contained.

Here we go:

  • The Robot Framework is implemented in Python.
  • It also provides a Java Standalone JAR release.
  • Testing functionality is implemented in Keywords, which is the central concept for implementing testing functionality.
  • Keywords for a certain topic (e.g. Database Testing) are bundled in so-called Test Libraries. The Robot Framework comes with a set of Standard Test Libraries .
  • New Keywords – and thus new testing functionality – can be written in Python or Java (and other programming languages that will not be covered by this tutorial).
  • In addition it is possible to create new Keywords by combining existing ones. Doing this is a bit like working with an own programming language.
  • The Robot Framework offers excellent reporting functionality and can be easily integrated to Continuous Integration (CI) Environments.

Robot Framework Installation

Evaluating the Installation Type

There are two different ways to install the Robot Framework as can be already seen from the previous chapter. It can be installed in its Python implementation or as a standalone Java JAR. Unfortunately this has some implications that should be considered from the very beginning.

There are more installation types, but those are either quite special like the .NET installation using IronPython or I simply do not want to recommend those from experience. This is true for using Jython to execute the Robot Framework.

Java Standalone JAR
This installation has some really nice advantages. Assuming Java is more often pre-installed than Python (at least on Windows) it is really an easy start by just downloading the fat JAR. Another really nice thing is that the JAR can be put under version control and thus everyone is really always using the exact same version of it. Also no local installations are required this way.

Sounds too good to be true? Unfortunately it is! If you would like to use some of the tools, especially the graphical IDE (RIDE) you need to install Python and the Python version of the Robot Framework anyway. Furthermore it is more complicated to get Python test libraries to use with the standalone JAR. On the other hand – when under version control – that is a task only one member of the team has to do. Using own Keywords written in Java is quite easy this way.

Python Installation
This is kind of the “natural” way of installing the Robot Framework. Everything else was coming later to especially make things easier for the (large) Java community. Of course all Standard Test Libraries can be used this way and also almost all external Test Libraries are available for the Python installation.

On first sight the biggest drawback here is how to use your own Test Libraries written in Java then. There are two possibilities. The first one is to use Jython, which from experience I would strongly discourage you to do. It always has been a pain one way or the other. The second possibility is to make use of the XML-RPC interface the Robot Framework provides. This is a really great way to use Keyword Libraries written entirely in Java with the Python installation. The next part of this series will deal with Keywords and also cover this.

Installation as such is easy as Python covers its own package manager – namely pip – and the Robot Framework and a lot of related tools and test libraries can be easily installed using pip.

Conclusion
It really depends, as much as I hate this phrase. When planning to use RIDE I think I would go for the Python installation, as it is anyway needed then. Otherwise having the test library under version control using the Java JAR is a nice option. Then again the Python version is faster in execution. If you have time to evaluate both installation types for your project that is of course a good thing to do. Otherwise start with the Python installation, you cannot do anything wrong with it in my opinion.

Performing the Installation

Java Standalone JAR
Download the Robot Framework JAR from here . (At the time writing this blog post 3.0 has been the most recent release. Please check for newer ones by browsing this directory .) Store the downloaded JAR to some proper place on your machine. On my Mac I installed this to /usr/local/opt/robotframework. When using Linux or Mac OS I recommend creating a softlink to point to the most recent Robot Framework JAR. This way updates can be done easier as commands used in scripts or documentation can stay unchanged.

ln -s robotframework-3.0.jar robotframework.jar 

Under Windows either just create a copy or you might be able to use a shortcut for this.

You can then execute the Robot Framework by issuing the following command (of course adjusted to your installation directory):

thomasjaspers$ java -jar /usr/local/opt/robotframework/robotframework.jar --version
Robot Framework 3.0 (Jython 2.7.0 on java1.7.0_79) 

Well, that’s it. The Robot Framework is now ready to use with all its Standard Libraries .

Python Installation
A prerequisite for the Python Installation of the Robot Framework is, well, uhm, Python :-). The latest release (3.0 at the time of writing this) is supporting Python 2.7, 3.3 or newer. I was using Python 2.7.11 when writing this blog post. When working with Linux or Mac OS a proper Python installation is probably available out of the box. Windows users can download Python from here and then install it. Test your Python installation by issuing the following command from the command line:

thomasjaspers$ python --version
Python 2.7.11

Note: It is important that Python can be executed without additional path information. Otherwise scripts and documentation will suffer from different installation directories.

Installing and updating the Robot Framework Python Installation can be best done using the Python Packet Manager pip . Pip should be pre-installed if you are using a recent Python installation. Otherwise it can be installed from the before mentioned web site. You can check your pip-installation with the following command:

thomasjaspers$ pip --version
pip 7.1.2 from /usr/local/lib/python2.7/site-packages (python 2.7)

Now we can install the Robot Framework by issuing:

pip install robotframework

As there was already an installation on my machine I cannot show the terminal output ;-), but luckily I can do an upgrade, which is also very simple using pip:

thomasjaspers$ pip install robotframework --upgrade
Collecting robotframework
  Downloading robotframework-3.0.tar.gz (430kB)
    100% |████████████████████████████████| 434kB 589kB/s 
Building wheels for collected packages: robotframework
  Running setup.py bdist_wheel for robotframework
  Stored in directory: /Users/thomasjaspers/Library/Caches/pip/wheels/5c/52/06/c52eb85b0443321cca0229c7e4c483d2d6d2988de3dd510f50
Successfully built robotframework
Installing collected packages: robotframework
  Found existing installation: robotframework 2.9.2
    Uninstalling robotframework-2.9.2:
      Successfully uninstalled robotframework-2.9.2
Successfully installed robotframework-3.0

Afterwards you can execute the Robot Framework as follows:

thomasjaspers$ robot --version
Robot Framework 3.0 (Python 2.7.11 on darwin)

share post

Likes

0

//

More articles in this subject area

Discover exciting further topics and let the codecentric world inspire you.

//

Gemeinsam bessere Projekte umsetzen.

Wir helfen deinem Unternehmen.

Du stehst vor einer großen IT-Herausforderung? Wir sorgen für eine maßgeschneiderte Unterstützung. Informiere dich jetzt.

Hilf uns, noch besser zu werden.

Wir sind immer auf der Suche nach neuen Talenten. Auch für dich ist die passende Stelle dabei.