Guide to Test Automation with Robot Framework

Learn more about how to deliver better software with test automation.
Download eBook Learn More

Robot Framework is a generic open-source automation framework for acceptance testing, acceptance test-driven development (ATDD), and robotic process automation (RPA). Robot Framework allows testers to easily write automated test scripts using a keyword-driven testing approach.

Teams using Jira and Xray can easily integrate testing results coming from the CI/CD pipeline. This provides a lean and scalable test automation process.

In this post, we’ll go over the main concepts and benefits of Robot Framework and show how you can use it to scale your test automation by reusing and extending existing keywords.

What is Robot Framework used for?

In the testing context, Robot is used for teams adopting ATDD (Acceptance Test Driven Development). Broadly speaking, it can be used to automate “test cases” (i.e. scripts) no matter the moment you decide to do so or the practices your team follows.

Unlike Cucumber and other automation frameworks, Robot comes with a set of standard test libraries to ease the interaction with the operating system, provide common assertions, and more. Since it is built in Python, it can be used and further extended using Python or Java.

Libraries are the standard mechanism to extend Robot Framework, even though there are more. In fact, a strong community around Robot continuously increases the number of available libraries and resources for Robot Framework.

Test libraries provide their own keywords; a well-known library is SeleniumLibrary that allows automation of browser interactions using Selenium/WebDriver.

How to write automated test scripts

With Robot Framework, you can easily write automated test scripts. Keywords are used to perform actions but also to provide assertion mechanisms. They can receive arguments as a means to condition their behavior.

As shown ahead, “Open Browser” and “Title Should Be” are some clear examples of that.  You don't necessarily need to code in Python/Java because there are many test libraries that provide the necessary bits of automation as keywords.

RobotFramework

In the previous example, you could also depict the ability to make composable keywords that may provide an additional layer of abstraction to separate the “what” from the “how.”

Overall, Robot Framework has some key features that make writing and maintaining test cases easier:

Robot Framework vs. Cucumber

If all you need is a testing tool for driving a mouse and a keyboard, don’t use Cucumber. There are other tools that are designed to do this with far less abstraction and typing overhead than Cucumber.”  

Aslak Hellesøy - Creator of Cucumber

Cucumber has many different implementations in different languages (e.g. Ruby, Java, Javascript). The company behind Cucumber has meanwhile been bought, and even though it has an open-source variant, the model is substantially different from Robot Framework which is backed up by a foundation, sponsored by many different companies.

Robot Framework follows quite a different approach from Cucumber:

  • Robot is admittedly a generic automation tool
  • Robot comes with a built-in set of test libraries and corresponding keywords
  • Robot is built around the premise that you can write test cases without even having to code, as there are many available libraries that provide reusable keywords and its underlying code
  • Robot covers RPA (Robotic Process Automation); Cucumber doesn’t

Note that Robot Framework can also be used for teams that adopt BDD and test automation; it supports Gherkin syntax for specifying test scenarios.

Xray and Robot Framework

Xray and Robot Framework are close friends. Why? Because teams using Jira can easily track their Robot Framework test automation results in Jira and use Xray as the single-source of truth. It’s as simple as submitting the results to Xray and letting it do the rest. 

Submit results by using a CI tool (e.g. Jenkins, TeamCity, Azure DevOps, Bitbucket) or even by doing a simple POST request (with “curl”, for example).

RobotFramework and Xray

How Xray supports processing Robot Framework test results

Auto-provision Tests
Avoid duplication during auto-provisioning
Import results
Detailed results
Import attachments (e.g. screenshots) Planned
Enforce results to existing Test issue (if you want)
Automatic linking to requirements

After a successful import, results can be tracked across Jira, mainly in the "test run" details, on the "user story" screen and also "agile boards."

RobotFramework and Xray

The process of importing Robot Framework test results into Xray is easy and intuitive.  If you want to go into more technical detail, don’t miss my next post - How to integrate Robot Framework with Xray. Meanwhile, go ahead and try it out. :)

Please share your thoughts and experiences with us in the comments, we’re always looking to understand how you use the product in real-life and how we can improve your experience. 


Want to hear first-hand from the creator of Robot Framework, Pekka Klärck, and learn how to use Robot Framework together with Xray? 

On June 30th, together with TechWell, we hosted a webinar called "Get Started Writing Automated Test Cases with Robot Framework." 

Additional Resources

Comments (3)