Robot Framework, A Good Way to Start With Test Automation

Azadeh Pourpakdel
limehome-engineering
4 min readMay 19, 2020

“We don’t have test automation yet, but we want to have it in the future”. This is a common phrase I have heard from many Start-Ups which doesn’t come true. Since this is not their priority and it is just something they would like to have someday. So, when I heard during my interview, I thought to myself that we won’t have it soon and it’s just a goal.

To my surprise, the first thing my Team Lead wanted me to do after we had our routine for manual testing was to set up test automation. Here we are now after six months since I started at Limehome and we have automated about 80% of our test scenarios.

How I made it happen

When I think about test automation, Robot Framework comes to mind. In my experience, it is a good tool when you want to automate your test process for web applications, mobile apps, or even APIs. It has a simple syntax and it’s easy to learn. On the other hand, it’s a powerful tool for test automation.

What Is Robot Framework

The story of Robot Framework began when Pekka Klärck was writing his master’s thesis. The framework was initially developed at Nokia Networks and now many companies are using it. For example, Axon is using The Robot Framework in testing embedded software and hardware development of broadcast equipment.

Robot Framework is an open-source automation framework for acceptance testing and acceptance test-driven development. It has a modular architecture that can be extended with bundled and self-made libraries. The core framework is implemented using Python and also runs on Jython (JVM) and IronPython (.NET).

Why Robot Framework

  • It’s free
  • Independent from operating system and application
  • Utilizes human-readable keywords so it’s easy to read
  • Contains a wide range of keyword libraries
  • No need to have programming knowledge
  • Keywords can be reused in different test cases

How To Install Robot Framework

The recommended approach to install the Robot Framework on Python is to use the Python package installer-pip. Once you have both of these preconditions installed, you can simply run:

pip install robotframework

Keyword-Driven Testing

The Robot Framework is keyword-driven. It means you first have to define a keyword then associate it to the related function. There are two kinds of keywords. The first ones are library keywords which you can easily use it in your tests. They are called lower-level keywords. The second kind is user-made keywords that are made by combining existing keywords together. They are called higher-level keywords.

One of the most useful libraries that has many keywords is the selenium library. Use the following command to install it:

pip install robotframework-seleniumlibrary

Composing Tests

Every test consists of Settings, Variables, Test Cases, and Keywords. But Variables and Keywords are optional. Here is a simple example of a test case that has user-made keywords:

You’re not a programmer? That’s Not An Issue!

Technically, you don’t need to be a programmer to learn Robot Framework. If you have a little coding (python or java) knowledge you can make the most out of it. Here is my latest experience with Robot Framework that I found to be pretty cool.

Recently, I needed a special keyword for API automation that wasn’t available in the Robot Framework libraries. So, I made my own library and imported it into my robot file and used it as an ordinary library.

How to run some Test Execution

Tests can be executed from the command line using the robot command:

robot test.robot

just remember to open the command line where the test is located.

Test results

  1. report.html that is a higher-level test report.

2. log.html is a detailed test execution log.

3.output.xml that contains the test execution summary in XML format.

CI Integration

Robot Framework can be integrated with Jenkins CI server easily, but we did ours with Gitlab and it’s doing a pretty good job. Here is a simple guide to integrating Robot with Jenkins CI server.

These are some useful resources that I used and they can be very helpful if you want to start:

--

--