robot framework people

Have you ever heard of Robot Framework? If not, then this article will show you why you should care about Robot Framework and how it can be useful to you in your test automation work.

What is Robot Framework?

Robot Framework is a generic test automation framework. You use it primarily for functional acceptance testing and it is well suited for acceptence test driven development (ATDD) or similar approaches, but has also been extended to be used for robotic process automation (RPA). It is open source and implemented in Python.

While it is frequently used for testing web applications, it extends far beyond that. It can be used for testing REST API’s, databases, Java desktop applications, mobile applications and really it can be used on most types of systems. More on that later.

Keyword-Driven

One of the benefits of using Robot Framework is that you have an easy way to define and execute test cases, without the need to know technical details. This makes it a very useful for collaboration between test engineers, domain experts and developers. And using keywords makes this happen.

If you are not familiar with keyword-driven testing, here are the most important things you need to know.

  • Keywords provide a layer of abstraction that hide implementation details away from the user.
  • Any action or step you define in your test case is considered a keyword.
    • example: Open login page
  • You can add arguments to keywords
    • example: Open login page user password
  • You can reuse an already defined keyword in multiple test cases.
  • Keywords are well suited for automation

Architecture

Robot Framework architecture diagram
Figure 1: Robot Framework Architecture

Don’t skip this section! The modular architecture of Robot Framework is one of the main attractions, since this is what provides you with the great versatility this framework offers.

You pass test data into the framework, which in turn communicates with the system under test through the use of libraries, as you will see more of in the next chapter.

The libraries can use tools internally to provide functionality or contain the whole implementation themselves.

An example of using tools, is the AppiumLibrary for mobile testing, which internally uses the Appium Framework to do all the heavy lifting. In this instance, the Robot Framework library acts as a wrapper of Appium functionality in keywords, ready to use.

By having this layered model, with the Library API at the core, Robot Framework makes it easy for you to:

  • Test practically any type of system regardless of technology stack. (This is something most Record-Playback tools promise as well, but with Robot Framework, you don’t have to sell your soul to get it. 😉 )
  • Maintain stable test cases, even if the technology in the system under test changes.
  • Have full control over how test tests call the system under test, by adding your own library.

Libraries

As mentioned earlier, Robot Framework can be used to test a wide range of systems. This is due to its well thought out architecture that you just saw, that allows external libraries to be plugged in to the framework.

External? Yes, well there are a number of libraries already included in the framework as standard libraries, for you to use. And you will use many of them for basic operations on files, strings, working with dates and lists and so on.

As for the external libraries, there are many external libraries developed by others, like:

Python logo

You can also create your own library. The easiest option is to create it using Python. Robot Framework natively understands Python.

But if you run Robot Framework on the Java implementation Jython, you can write libraries in Java, and for .NET you can run IronPython and write libraries in supported .NET-languages.

In addition you can use the remote library feature, which opens up even more options. A remote library launches a remote server as a gateway to your library. There are remote servers available for Java, Ruby, .NET, Clojure, Perl, node.js and PHP. Check out the project: https://github.com/robotframework/RemoteInterface

Reporting

Reporting is a very important feature in a test framework. Some frameworks come with only basic reporting functionality, that you normally can expand on yourself. But with Robot Framework you get a very comprehensive report and log out-of-the-box.

A test run produces three report artifacts. A report.html with an overview of the complete test execution. A log.html that contains details for each test, including output from each keyword executed. And finally an output.xml containing the raw data in XML format. Anyone interested in the test result, can read the HTML files, which are formatted to be human readable. External tools can use and process the XML file, eg. a test management system or continuous integration system.

The report looks like this:

Robot Framework Test Report
Figure 2: Robot Framework Test Report

In case you are wondering, the background color is not always green. When one of your tests fail, it changes to red. This is a small feature, but it can actually be very valuable. Failed tests should make noise!

Community

You are going to get stuck! And you will have questions. When this happens, you can join the Robot Framework online communities and get help.

Slack logo

The most active place is probably Slack, where you will find several channels for specific topics.

Also you should visit the new Robot Framework forum and the still active mailing list on Google Groups.

The community is friendly and very helpful, both helping you solve problems you might run in to and in general discussing the use of the framework and the surrounding ecosystem.

Development and maintenance

Robot Framework was originally developed by Pekka Klärck as his masters theses in 2005, and was further developed during his time at Nokia Networks and finally open sourced in 2008. Pekka is still active as lead developer on the framework.

Since then, the Robot Framework Foundation has been established as a non-profit organisation with the objective to sponsor the development of the framework and the ecosystem. They are also helping in organising local meetup groups as well as the annual RoboCon conference.

As of today there are more than 40 members of the foundation. This provides a strong backing for the framework.

Conclusion

Robot Framework is a keyword-driven generic test automation framework written in Python. It is a versatile framework that can be used to test most systems regardless of technology.

At the core of its architecture is a library API, that allows external libraries to be used to communicate with the system under test. Apart from the standard libraries being included, there is a growing number of libraires developed for both common and not so common technologies. A comprehensive test status report and log is built in, that has both an HTML version and XML version.

There is a very active community around Robot Framework, with a lot of discussions, which mostly takes place on Slack. And the creator of the framework, Pekka Klärck, is very active in the community and is lead developer on the framework. However, the development has been adopted by the Robot Framework Foundation, where over 40 members now sponsor the framework development.

Go check out Robot Framework now. Or wait, because soon you can read the next part in this two-part series, Why you should care about Robot Framework – Part II, where you will be introduced to writing and executing test cases in Robot Framework. Coming soon…


Share this post with your friends and followers: