Robot Framework


Robot Framework

Robot framework is a generic test automation for acceptance testing. Acceptance test-driven development (ATTD). It utilizes the keyword-driven testing approach. Provides test libraries implemented either with Python or Java, and users can create new higher-level keywords from existing ones using the same syntax that is used for creating test cases. Not much programming is required.

Why do we use a robot framework?

• Anyone who wants to test it out can do so easily because the Robot framework is free source.

• It facilitates the creation and execution of test cases and is relatively simple to install. To start using the robot framework, a newcomer does not need advanced testing knowledge and may learn it with ease.

• It supports developing test cases in a keyword-driven, behavior-driven, and data-driven manner.

• It provides excellent support for outside libraries. The Selenium Library, which is simple to set up and use in robot frameworks, is the most popular.

Selenium with Python using Robot Framework

How do Libraries work?

Several external libraries, including the Selenium Library, Database Library, Date Time Library, and BuiltIn Library are supported by the Robot Framework. The main reason SeleniumLibrary is utilised is because it facilitates communication with browsers and supports web application and UI testing.

How do Variables work?

The robot framework supports scalar, list, and dict variables. While designing complex test cases, the variables in the robot framework are quite helpful and simple to use.

How do Test Cases work?

Test cases are constructed in test case sections from the available keywords. Keywords can be imported from test libraries or resource files, or created in the keyword section of the test case file itself.

How do Keywords work?

Robot framework comes with built-in keywords available with robot framework, keywords available from the libraries like Selenium Library (open browser, close browser, maximize browser, etc.). We can combine built-in, library, and other user-defined keywords to build user-defined keywords, which are another option. These user-defined keywords can also accept arguments, making them similar to reusable functions.

Keywords

• open browser - Opens a new browser instance to the optional URL.

• close browser - Closes the current browser.

• close all browsers - Closes all open browsers and resets the browser cache.

• maximize browser window - Maximizes current browser window.

• sleep - Causes the current thread to suspend execution for a specified period.

• input text - Types the given text into the text field identified by locator.

• click element - Click the element identified by locator.

• log to console - Logs the given message to the console.

• switch window - Switches to browser window matching locator.

• get location - Returns the current browser window URL.

• get element count - Returns the number of elements matching locator.

• go to - Navigates the current browser window to the provided URL.

• go back - Simulates the user clicking the back button on their browser.

• get text - Returns the text value of the element identified by locator.

• capture element - Captures a screenshot from the element identified by locator and embeds it into log file.

• capture page - Takes a screenshot of the current page and embeds it into a log file.

File Upload

open browser https://www.tutorialspoint.com/selenium/selenium_automation_practice.htm - opens the given URL in chrome browser.

maximize browser window - Maximizes current browser window.

${browser} ${url} ${UploadFile} ${AddFile} - Variables

UploadFile - Passing keywords from the Test Cases

sleep - Causes the current thread to suspend execution for a specified period.

choose file - Inputs the file_path into the file input field locator.

Handle tabbed windows & switch windows

open browser https://demo.automationtesting.in/Windows.html - opens the given URL in chrome browser.

click element - Click the element identified by locator.

switch window - Switches to browser window matching locator by title.

close all browsers - Closes all open browsers and resets the browser cache.

Capture screenshot

open browser https://www.saucedemo.com/ - opens the given URL in chrome browser.

input text - Types the given text into the text field identified by locator.

capture element screenshot - Captures a screenshot from the element identified by locator and embeds it into log file.

capture page screenshot - Takes a screenshot of the current page and embeds it into a log file.

Get all links

open browser https://www.meteoriqs.com/ - opens the given URL in chrome browser.

maximize browser window - Maximizes current browser window.

get element count - Returns the number of elements matching locator.

FOR - Here we are starting our for loop. We will create list @{LinkItems} list variable, it representing the ${i} index variable, IN RANGE from 1 to no of links ${AllLinksCount},

get text - Returns the text value of the element identified by locator.

xpath:(//a) It will map all the links, [${i}] filter with one using index value

${linkTest} - Storing that in a variable.

log to console - Logs the given message to the console.

Navigation

open browser https://www.google.com/ - opens the given URL in chrome browser.

get location - Returns the current browser window URL.

log to console - Logs the given message to the console.

go to https://www.facebook.com/ - Navigates the current browser window to the provided URL.

go back - Simulates the user clicking the back button on their browser.

close browser - Closes the current browser.

Conclusion

Robot Framework is a powerful, open-source test automation framework that allows testers and developers to easily create and execute automated tests for web, desktop, and mobile applications. It has a simple syntax and a modular architecture that makes it easy to create and maintain tests.

Get in Touch and let us know
how we can help

Get started

Our brand name and motto embody our unwavering commitment to delivering services with agility, quality, and efficiency, ensuring that our clients and international business partners receive unmatched excellence.

Address

meteoriQs Towers,
1B, Ground Floor Business Center,
SheshadhriNagar,
Nedungundram,
New Perungalathur,
Chennai-127, India