Robot Framework: Automation Made Easy

Why a Robot framework?
As a QA engineer, performing manual testing sometimes takes lots of time and becomes repetitive. In addition to it, when bugs are fixed, or new implementations are done, regression testing is no longer a simple task. Also, as the number of features increases in any product, manual test coverage becomes difficult to manage, which may lead to missing bugs. That's why my QA team and I were searching for some automation tool to help us address the above issues. After exploring tools like Selenium, Katalon and the Robot Framework, our preferred choice was the Robot framework, which has proven to be the best tool as it is easy and quick to write automated scripts using it.
Robot Framework is used as an open source automation tool for acceptance of test-driven development and Robotic Process automation. Robocorp provides tools to write and execute software robots. Following are the cool set of features of Robot Framework:
- Keyword driven
- Good support for external libraries with various programming languages
- Detailed logs
- Explicit Reports
This is an installation guide for getting started with the Robot framework. You know that to automate a process, you need to understand it first. Here at Glide Invest, we have our website for which I need to perform smoke testing daily as loading all pages is our critical requirement for customer engagement. Running the Robot framework also verifies that the site is up and running, also detailed reports help in monitoring the time each task has taken so that I am able to check the performance part of it.

Home Page of Glide Invest website
As you can see from the Home page, it consists of different menus, and each menu also has a sub-menu under it. So manually testing becomes repetitive and time-consuming. To approach this issue, I made use of this easy-to-implement and quick automation framework. So let's quickly go step by step for setting up robots.

Step-1: Download and Setup Visual Studio
- Download the Visual Studio from https://code.visualstudio.com/ and read along with this blog. VS code always comes with the latest version updates, you can download the latest stable version as per your requirements.

Step-2: Installing extensions for dependencies
- After installing the VS code, you will land on the screen below once you open it. Click on the extension's icon on the sidebar and then search for Robocorp. You need to install two extensions: Robocorp Code and Robot Framework Language server. So click on the install button for respective extensions. That's all the setup we really need.

Step-3: Create Robot
- Now that the setup is done, you can begin creating a new robot to perform the automation task. Create your directory and name it. To start, you can use commands such as “command + shift + P” for Mac and “Ctrl + shift + p” for Windows and Linux to bring up the command console. This command is provided by Robocorp code extension. Type “Create Robot” and select the command for the same.

- Then choose “Standard” as a template for our robot.

- Use the location you prefer to finally complete the robot's creation process.

Step-4: Code and Run the Robot
- You will see the task. robot file in your created directory where you will code to achieve the intended automation task.
- The first section is Settings, where you will add the library. Here I will be using it for my test case: opening the Glide invest website in a browser and doing smoke testing. You can do it for your test case.

- The second section of the code is about declaring Variables. So very simple syntax is used, as shown in the below screen where I have declared the URL, browser and menus I want to navigate through.

- Finally comes the last section, called Test cases, where you can write all the tasks you want to execute and see the output in the terminal, which gives an idea of how many test cases got passed and failed.

Point to Remember:
While launching the browser, you will need to give the executable path of your chrome driver. Chromedriver, in simple words, is a separate executable that Selenium WebDriver uses to control Chrome. You must ensure that you have a compatible version for the browser you are using. Similarly, other browsers have their own drivers. To install chromedriver you can refer to this link https://sites.google.com/chromium.org/driver/
Conclusion
Automation testing with the Robot framework has become as easy as you wanted. Installing VS code, Robocorp extensions and compatible browser drivers are all you need to perform your first automation testing without any prior knowledge of coding.
In the next post, we will learn about other robot files in detail and how to see reports after execution.