This Tutorial Explains What is Robot Framework Along with its Pros, Cons, Important Features and Installation Instructions:
Robot Framework is an open-source Test Automation framework. It was initially developed by Nokia Networks, however, it is now maintained by the Robot Framework Foundation.
You will learn about the features, pros, and cons of the Framework along with instructions to install the needed software.
List Of The Tutorials In This Robot Framework Series
Tutorial #1: Robot Framework – Features And Software Installation (This Tutorial)
Tutorial #2: Getting Started With RIDE – Robot Framework IDE
Tutorial #3: Understanding And Working With Robot Framework
What You Will Learn:
What Is The Robot Framework?
Official Website: RobotFramework
Robot Framework is a Test Automation tool in which the test cases are written using keywords that makes it easy to learn and use.
These keywords are written in a tabular form. With Robot Framework, the Test Scripts are replaced by a few keywords thereby replacing the need for large pieces of code.
Let us understand the keyword-driven approach of this Framework with a simple example.
Example: Suppose, I want to test a website say Google.com, for which the very first step would be to open a Browser and open the ‘Google.com’ webpage. Now to automate this step using Robot Framework, we have a keyword called “Open Browser”.
The script for this step would look as shown below:
Do you agree that this code looks quite simple?
I am sure, your answer would be ‘yes’. This simplicity makes it easy to learn and use the tool. We have pre-defined Keywords and Libraries that can be used. Just by knowing these available keywords, we can automate our test cases and greatly reduce our testing efforts.
You must be wondering about the language in which the Framework is written. It has been written using the Python programming language. Hence, to install Robot Framework it is necessary to have Python installed in your system. There are also a few other sets of software that are required to use this Framework.
We will see more about this as we proceed further with this tutorial. Robot Framework provides good support for External Libraries as well as Functions. The most popular library used with the Framework is the Selenium Library that is used for web development & UI testing.
With this brief understanding of what Robot Framework is, let us take a look at the other features of this Framework.
Features Of Robot Framework
Enlisted below are the main features of the Robot Framework:
- Robot Framework is used for Acceptance Testing and Acceptance Test-driven development.
- The Framework uses the keyword-driven approach where small understandable words (either pre-defined or user-defined) are used for writing scripts.
- It supports Test Automation for different data sets thereby supporting data-driven testing.
- It shuns the use of large code and follows a behavior-driven testing approach.
- Test cases are written using keyword (pre-defined or user-defined) in a tabular format.
- Users have the option of creating their keywords.
- It supports the use of Variables.
- It can interact with third-party libraries and functions.
- It allows tagging of test cases that come handy while trying to run either of the Smoke Test Cases, Regression Test Cases, System Test Cases, etc.
- It provides detailed reports and logs of the execution status which is very helpful in case of failure of the script.
- The reports and logs are generated after every build execution.
Pros & Cons Of Robot Framework
Some of the advantages that contribute to the popularity of this Framework are:
- Being open-source, it is readily available for use by everyone.
- Its capability gets extended by the use of External Libraries and Functions.
- Besides the available Library Keywords, high-level keywords can also be created by the user which further enhances its use.
- As Robot Framework does not require the user to write a complicated piece of code, it is easy to learn and use the tool.
The most likely disadvantage of using this Test Automation Framework is that it does not allow nested loops and thus it comes as a constraint to test complex scenarios where multilevel looping is to be used.
With this basic idea of this Framework, let us move ahead to the next topic which will help you set up your system to use Robot Framework. We would now be going ahead with the understanding and installation of various software that is required to use the Framework.
Let’s get going!
Robot Framework – Installation Instructions
A couple of Software are required when it comes to using the Robot Framework.
The following software are required for us to be able to use the Framework.
- Robot Framework
Let us now quickly go with the installation of the first software ‘Python’ followed by the rest as mentioned above.
#1) Python Installation
Robot Framework has been written using the Python programming language. It also supports Jython as well as IronPython. Thus, to work with the Framework, it becomes mandatory to have Python installed on our system. Let’s begin the software installation process by installing Python.
In case you are unsure if Python is already installed on your system, use the command below at the command prompt and press ‘Enter’.
If Python is already installed on your system, then the Python version will be displayed and what you see at the command would be similar to the below.
However, if Python is not installed then the below message will be shown.
Follow the below steps to download Python:
#1) Open this link in the browser. You will be able to see the latest version available for download. Press the button “Download Python 3.8.0” as shown in the snapshot below.
#2) However if you wish to download the desired version scroll down below and you will see a section listed with all the releases. You can select and download the desired release by selecting the ‘Download’ option against the respective release. We have demonstrated for version 2.7.14 below.
#3) Select the MSI installer as per the system specifications. Here, we are selecting for 64- bit Windows Operating System.
#4) Make the selection as highlighted in the below screen and choose ‘NEXT’.
#5) Select the folder where you wish to download and click ‘NEXT’.
#6) Select ‘Next’ on the next two screens and you will see the below screen where the installation begins.
#7) Wait for the above installation to get completed and then select FINISH.
Starting from Python 2.7.9, the standard Windows installer by default installs and activates Pip. So, once you download Python, Pip also gets downloaded along with it. Remember, Pip is the install Manager for Python.
Now Python27 folder should be created in the C drive (as in this case). Execute the below commands to check the version of Python and Pip that have just installed.
Setting Up Environment Variables For Python
After installing Python on the system, the environment variables need to be set for the same. To do this, first make a note of the exact path where Python is installed on your System (‘C:\Python27’ in our case below).
Before we see how the Environment variables are set, let us understand the need for setting it up. Environment variables are the system variables that are globally accessible by all the processes on the system. These variables store the path of the executable programs and using the defined path the Operating system can access the program(s).
Let us follow the below steps to set the environment variables.
- My Computer (Right-click) => Properties => Advanced System Settings=> Environment Variables
This would open the below pop up window to set the Environment Variables.
Select ‘Path’ System variable and append the paths where python is installed as well as the path for its scripts folder separated by a semi-colon (;) along with the existing path values.
In our case it is the Paths mentioned below:
- After appending both the paths, click ‘OK’ to close the ‘Edit System Variable’ pop up.
- Click ‘OK’ to close the ‘Environment Variables’ window.
- Finally, click ‘OK’ to close the ‘System Properties’ window.
#2) Installing Pip
As stated above in ‘Python installation’ Pip gets installed automatically along with Python (from Python version 2.7.9 and above). Thus, there would be no need for downloading it separately.
What is Pip’? As already mentioned,‘Pip’ is the install Manager for the Robot Framework. This means that if we have Pip on our system, we can install the Robot Framework using it. Installing the Framework using Pip is the recommended option.
In our next topic, we will see how we can use ‘Pip’ to install Robot Framework.
#3) Installing Robot Framework
We will now use pip to install the Robot Framework. Type the below command in the command prompt to install the Framework.
After the installation gets completed, you can check the version of the Framework that has been installed using the command below.
#4) Installing wxPython
Let us now download and install WxPython. WxPython is needed to use Ride which is a UI for Robot Framework.
Ensure to install WxPython for the same bit version (32 bit or 64 bit) for which Python was installed. Please follow the steps listed below-
#1) Open the URL in a browser and scroll down to view all the available versions.
Click the folder version of WxPython that you wish to download. Version 18.104.22.168 is selected below.
#2) Now as per your system specification, select the file to be downloaded for the selected WxPython version. In our case it is a 64-bit Operating system, hence we are selecting the first file highlighted below.
#3) Once downloaded, open the Downloads folder on your system and run the .msifile to install WxPython.
#4) Run the wizard below and click ‘Next’.
#5) Click the radio button “I accept the agreement” and select ‘Next’.
#6) Select ‘Next’ if the location displayed is where you want the installation to take place. Else, browse to the desired location and select ‘Next’.
#7) Select ‘Next’ again.
#8) The installation process will begin and just wait till it is 100% complete.
#9) Now select ‘Finish’ to close the installation wizard.
Ones the installation process gets completed, the same can be rechecked by opening the Control Panel => Add/Remove programs and confirm the presence of Python and WxPython.
#5) Installing RIDE
The last step in using the Framework is to install RIDE, which is the IDE for writing scripts in Robot Framework.‘IDE’ stands for Integrated Development Environment.
As the name itself suggests, an Integrated Development Environment is an application that provides an environment for coding and scriptwriting which includes an editor, a compiler/interpreter, a debugger, and maybe an automated build management tool as well. RIDE would be our IDE, to automate our tests using the Robot Framework.
To install RIDE, execute the below command on the command prompt.
Once the RIDE is installed, you can open RIDE by typing the command below.
It can also be accessed by creating its shortcut on the desktop. It is to be noted that besides RIDE, there are also other IDE’s that are available for writing the Robot Framework scripts.
For Example, Eclipse, PyCharm, VS Code, etc. However, as these IDE’s have not been natively built for Robot Framework, you would have to install their respective plugin to use them.
With this, we come to the end of the installation process for using the Robot Framework.
We now have all the basic software installed on our system to write scripts using the Robot Framework. Moving forward we will go through the basics of Ride and learn how to write test cases in it.