The basic idea

In a nutshell, Robot Framework is a basic open-source framework for automated testing, aimed at acceptance testing for web apps used in a browser, or for API testing.

“Basic” here says nothing about what the framework can do. It means generic: the framework provides the most basic building blocks for testing.

Robot Framework's main job is to provide those building blocks so users can create and run their own automated test cases. That is why most Robot Framework libraries wrap existing, also-open-source frameworks:

And there are plenty of other libraries.

Strengths

For example, Element Should Be Visible means checking whether an element is visible on a web page; if it is not, the keyword fails. The keyword wraps Selenium's is_displayed() function.

With Selenium and Python, a line like this is not immediately obvious unless you have Selenium's documentation open beside you:

assert element.is_displayed() == True

With Robot Framework, reading the keyword usually tells you what it is doing.

Typical question: What is Robot Framework?

Typical question: What types of testing frameworks are there?

Typical question: What is Keyword Driven Testing?

Selenium Library

In this blog's Robot Framework section, I will focus on SeleniumLibrary because browser automation is the easiest part to set up and demonstrate. The more interesting parts of Robot Framework will also be explained with SeleniumLibrary examples. If I have time, I may later look briefly at libraries such as Appium for mobile testing and RequestsLibrary for API testing.

SeleniumLibrary is one of Robot Framework's important libraries. It wraps Selenium and provides keywords for automated browser testing. That is why I want to use it throughout the Robot Framework articles: it covers the whole path, from writing scripts to reading logs and finding bugs.

First, SeleniumLibrary is just a library, meaning that it provides keywords. Those keywords wrap library functions, so under the hood Robot Framework is still using Selenium.

Selenium's structure

Selenium has four main parts:

You can also consider Client API a fifth component, although it sits inside WebDriver and can be grouped there. WebDriver supports several programming languages, including Java, Python and JavaScript. If Robot Framework uses Python bindings to operate Selenium, those bindings are the Client API.

What can SeleniumLibrary do?

SeleniumLibrary basically helps us do what Selenium can do. Some example keywords are:

There are also assertion keywords, such as:

There are many more. I will go through some of them in later articles, but they are all in the documentation, so go and read SeleniumLibrary.

Typical question: What is Selenium Library?

Typical question: What are Selenium's components?

Typical question: What are some SeleniumLibrary keywords?

References