Introduction to Functional Web Automation with Robot Framework

Payoda Technology Inc
4 min readJul 23, 2021

--

Robot framework is an open-source test automation tool that handles acceptance testing.

This tool uses the inbuilt selenium library to call keywords along with the test data, and hence it can be used to cover the functional automation workflows for web applications. The robot framework is application agnostic. The core framework accepts the Python scripting language.

It has an easy syntax with readable keywords. The user can extend the libraries with Python or Java. This framework is application-independent, users can also run the developed scripts using Jython(JVM) or Iron Python(.Net).

What is Robot Framework?

Robot Framework is one of the most versatile frameworks which holds several inbuilt libraries and facilitates reducing the lines of code. This makes the creation of test scripts much easier and faster. It has a modular architecture and so all of its data are stored in a suite format which makes it easy to call the linked libraries from each test suite.

Why Robot Framework?

  • It has easy-to-use syntax and readable keywords for the formation of the test scripts.
  • Users can reuse the created keywords in other test scripts.
  • The reports and logs are in HTML format, which is easily readable and provides a clear understanding.
  • Users can classify the test cases by tag name, so based on modules, the test execution can be kept separate.
  • We can integrate the suite with CI/CD platforms.

Modular Diagram

Advantages

  • Easy to install and use.
  • Even a novice can understand the scripts easily.
  • Supports the selenium library, so the test cases can call integrated keywords.
  • It supports keyword, data, and behavior-driven test cases.

Limitations

  • Parallel execution is not possible with the Robot framework.
  • Report customization is not possible, because by default Robot Framework generates reports in the .HTML format.

How does it work?

The robot framework will have the main file and a resource file after installing all the required software. The files will have the extension .robot. The Main file will have settings with all the needed library files such as suite setup, suite tear down, and test cases.

In the test cases section, the user can form their own sentences of what that particular test case should do and use the linked resource files to call the library variables.

The resource file will have settings, variables, and keywords. The settings section will have the libraries that we use for scripting and also acts as the object repository which holds all the web element locators.

All the variables in the resource file will be declared with a dollar symbol ($) followed by the variable name. Then come to the keywords, which define the action to be performed. Inside each keyword section, we will be using the predefined keywords provided by Selenium2Library.

Default keywords will be mapped against the variables and the keywords are then linked to the main file.

If the user wants to maintain the configuration data separately, they can do so by creating a config.py file that can be used to store the configuration details.

Example

Selenium2library

This library provides similar functionalities to the selenium web driver. It has inbuilt functions which are written in python. So, comparatively run time or execution time is minimal with this framework when compared to others. Because all the keywords are already defined, a user just needs to pass the input data as arguments. The user can also implement keywords using Java, JavaScript, Perl, .Net and PHP along with Python.

When the user calls the selenium library functions, it returns the syntax and the definition from the reference file. Most actions are already prepared as a function / keyword in the selenium2library.

Python

Before running the selenium2library, it’s mandatory to install python because all the functions in the libraries are in the python language and they are integrated together. Refer below for the installation steps to use the Robot framework tool.

Installation Steps

1. Install python

https://www.python.org/downloads/release/python-2711/

a. Select the windows 64 bit MSI installer.
b. Path: C :( Python 2.7.11).
c. Set the environment variables (My computer -> Properties -> Advanced System Settings -> Environment Variables -> System Variables -> Path)
d. Add C:\Python27;C:\Python27\Scripts;C:\Python27\Lib\site-packages; in environment variables

2. Download the get-pip.py file and save it inside C:\Python27

https://pip.pypa.io/en/latest/installing/

a. Open command prompt -> C:\Python27> -> Enter python get-pip.py

3. Install robot framework from the command prompt

https://pypi.python.org/pypi/robotframework#sthash.rBQpS2uV.dpuf

a. Open command prompt -> C:\Python27> -> pip install robotframework

4. Install selenium2library using command prompt

https://github.com/robotframework/Selenium2Library

a. Open command prompt -> C:\Python27> -> pip install robotframework-selenium2library

5. Download Pycharm community edition

https://www.jetbrains.com/pycharm/download/#section=windows

a. Path: C :( pycharm-community-2016.1.2)

6. Open pycharm-community and create the project

a. Click File -> Settings -> Plugins -> Browse Repositories -> Install -> IntelliJbot and robotframework support

Reporting

The robot framework will deliver reports in the form of . HTML, which will display the test cases along with their suite name if provided in the framework. It has inbuilt libraries to show the reports in a readable format.

Author: Priyadharshini.A

--

--

Payoda Technology Inc
Payoda Technology Inc

Written by Payoda Technology Inc

Your Digital Transformation partner. We are here to share knowledge on varied technologies, updates; and to stay in touch with the tech-space.

No responses yet