Robot Framework - Test Automation the Smart Way!

Robot Framework is a keyword-driven test automation framework, written in Python. Features include: high-level architecture, simple tabular syntax, data-driven test cases, separate test data editor, clear reports. It's functionality can be extended through self-developed and Remote libraries.

Each and every web development team runs a battery of tests on its products, yet delivered web solution later on sports defects. QA team strives to detect them before the initial release but those bugs always crawl in and they often reappear, even with the best manual testing. Automated web testing is you best bet to boost the efficiency and broaden the scope of your software testing.

Robot Framework is a keyword-driven test automation framework, written in Python. It empowers testers to automate and manage complex workflow scripts efficiently. Before we discuss the architecture of Robot Framework in details we have to cover its core notion, keyword-driven or table-driven testing.

Keyword-driven/Table-driven testing

Keyword-driven testing or some call it table-driven testing are the notions widely applied to an application-independent automation. The tester needs to develop data tables with keywords, independent of the test automation framework or any other tool used to run them. Then it is required to code the test script that will, in its turn “drive" the tested application and the data. Tables in a keyword-driven test will contain the information on the functionality of the tested application and step-by-step instructions for each test. Overall, we can speak of:

  • Higher-level keywords: They are used to test a specific aspect of the system.
  • Lower-level keywords: To keep the test cases minimal and concise the required functionality testing is separated into several lower-level keywords.
  • Technical keywords: They are implemented into the test to actually access the system and run the tests.

Now that it is covered, let’s proceed to the vast functionality of Robot Framework.

Robot Framework Features

All the features, mentioned below ensure that Robot Framework can be used to automate test cases in a quick and proficient fashion.

  • High-Level Architecture
  • Simple Tabular Syntax
  • Data-driven Test Cases
  • Separate Test Data Editor
  • Clear Reports
  • Detailed logs
  • Generic test libraries
  • Webtesting, Swing, SWT, Windows GUIs, databases, SSH, Telnet,...
  • Remote test libraries and other plugins for Jenkins/Hudson, Maven, Ant,..
  • Text editor support: Emacs, Vim, TextMate

Testing Libraries

Once you’ve installed Robot Framework you get the core framework and a bunch of useful Standard Test Libraries. But you are not limited by those in any case. Apart from Standard Test Libraries there are many external ones that are mostly contributed by the generous Robot Framework community and serve different purposes. The cool thing about those is that you can mix and match all the keywords from all the different libraries out there the way you like and create your own keywords for a concrete test case.

Remote Libraries

To make Robot Framework “supreme” Framework we can use Remote Libraries to write our own Test Libraries in any programming language that supports the XML-RPC protocol and run them on different machines if that’s what we need. Remote Libraries are employed the same way as “normal” Test Libraries, except you’ll need to import them in Test Cases and/or Resource Files. Another huge advantage here is that Robot IDE also fully supports this functionality and can utilize the documentation from Remote Libraries. When it comes down to writing the keywords in your own Test Library, do it in Python IDE you want, or e.g. Eclipse when using Java as a programming language.

Robot IDE is a graphical user interface called RIDE (Robot Integrated Development Environment) that can be of a great help while coding and managing test cases and keywords written in Resource Files. RIDE provides development environment for Robot Framework test cases with framework specific code completion, syntax highlighting, keyword completion, etc. Its configuration simplifies writing test cases by offering tunable configurations for different aspects of testsuites that can be automatically updated or edited via a GUI.

Test Cases

Writing Test Cases

Moving on to the test cases, Robot has all its test cases in tables. You can save them either in HTML or table-separated value (TSV) files.

Managing Test Cases

There are several ways in which you can organize test cases in Robot Framework. Test cases are made into test suites, which are sets of test cases, taken either from single or multiple files. The simplest example of a test suite is a single HTML file containing multiple test cases.

Another key feature of Robot is test case tagging. Each tag (e.g. critical, quick) assigns a test case to a separate set. When executing, you can run the tests based on tags, like “critical” and “quick”.

Running Test Cases

Once we’ve finished writing the test cases we need, those can be executed using provided Python scripts. Since our lovely Robot Framework is system- and platform- independent - we can run our tests any platform with Python: be it Windows, Linux, Unix or Mac.

The execution of test cases is done in the following steps:
• collecting test cases, reading and setting variables
• running all the steps in every test case
• providing the execution statistics (which test cases have passed/failed)
• writing the detailed log in xml format
• generating the report and log in html format.
The tester can set numerous options from the command line: select the test cases by name or tag, set variables, even configure the order in which those tests will be performed. The last option is really useful. You can run tests randomly, thus increasing the probability to find bugs.

Tested application interface

Robot Framework is so versatile that it allows you to perform command-line, web and GUI testing. Other interfaces can be tested using self-developed libraries. For command-line testing, we can use Operating System and SSH Library. With Operating System you can set up and configure working environment, manage files and system processes. SSH Library allows us to access a remote host, run commands and transfer files.

The second interface, supported by Robot Framework is the web using real browsers. Here, we have a Robot Selenium library to work with Selenium Web testing system. The Robot Selenium library already includes keywords to open a web page in the browser window, input some text, click a button, submit, etc. So, it makes your automated testing of web applications so much easier.

The third interface we can test with Robot Framework is GUI. Currently the Swing GUI library exists. It provides keywords such as Push button, Menu item should be selected, Start application, Close window, pretty simple and self-explanatory.

Summary

Robot Framework is a very easy-to-use, yet still powerful enough to be an acceptance-level test automation framework. It is quite flexible and you can extend its functionality through Python and Java modules. You don’t need much programming experience to write test cases. Writing them in tables makes your tests well-structured and ultra-readable. The logs and reports are also a good information resource. Hands down Robot Framework is our go-to web automation tool. If you want to know more how to perform test automation with Robot Framework to secure your web applications, contact us.

Connect with our experts Let's talk