Robot Framework is a generic open-source automation framework. It was initially developed by Pekka Klarck at Nokia Networks. It is software released under Apache License 2.0. Most of its libraries and tools in the ecosystem are open source.
This framework is mostly used for acceptance testing, acceptance test-driven development (ATDD), behavior-driven development (BDD), and robotic process automation (RPA). It uses a keyword-testing technique approach. Also, the capabilities can be extended by test libraries that either java or python can implement.
- Install Python
- Install PIP
- Install PyCharm IDE
- Download Selenium Browser drivers for the browsers
If you already have Python with PIP installed, Open the terminal and navigate to the python folder. Now type the following command to install the required packages:
- Install selenium
- Install robotframework
or install robotframework==2.9.2 (for specific version)
- Install robotframework-seleniumlibrary
To Install IntelliBot #patched for PyCharm to identify robot-related files or robot framework test cases, do the following steps:
- Go to settings in PyCharm
- Select Plugins
- Search for IntelliBot #patched
- Click on the install option for IntelliBot #patched
- Restart pycharm IDE
Project Folder Structure :
Basically, the folder structure contains multiple directories. Usually, in a robot framework, the key directories that we need to add to any project are the tests directory, resources directory, library directory, and results directory.
- Tests – In this directory, all the test cases are organized.
- Resources – This directory contains the commonly used keywords.
- Results – In this directory all the result files i.e. execution logs are stored.
- Libraries – This directory contains custom libraries.
Files that we use in our robot framework project and their extensions:
.robot: files that contain robot framework test case
.xls: excel file that holds the test data
.txt: notepad that maintains the data
.py: python files to implement the code for the keyword
First Test in Robot Framework:
- Step1: Create a file under the ‘Tests’ folder with the .robot extension. The .robot files are considered as Test Suites by Robot Framework.
- Step2: Mention the four sections in the robot file as follows:
***Settings*** – This section imports test libraries, resource files, and variable files.
***Variables*** – This section contains the defined variables that are used commonly
***Test Cases*** – In this section, we write our test cases
***Keywords*** – In this section we can define our own keywords
- Step3: Write a test case to launch the browser
- Launch Browser: It is the name of the test case
- Library Selenium Library: This imports the selenium library into our test so that we can use the selenium commands.
- Open browser: Keyword in robot framework which opens the URL in the browser.
- Step4: Execute the Testcase using the below command
Read our next blog on “How to handle Keyboard Actions in Robot Framework”.