Exploring Robot Framework
June 04, 2025
Exploring Robot Framework: Lessons from a POC
Welcome! If you're new here, part of the reason I started this blog was to reflect on and document different experiences in my career—what went well, what didn’t, and what I learned. Today, I’m diving into my first real use of Robot Framework, a keyword-driven test automation framework written in Python.
This post is as much a record for myself as it is a resource for anyone curious about evaluating or getting started with Robot Framework.
A Rushed Release and a Lesson Learned
A few months ago, we were developing a POC project for an automotive OEM to renovate and speed up their backend processing of vehicle data. We had recently deployed an MQTT broker and a new custom-built authentication service to upgrade the way vehicle data was transmitted, stored, and accessed.
Admitedly, in the rush to meet a deadline, I pushed a code update to our staging environment that inadvertently broke a couple of key functions. Our architect wasn’t thrilled, and rightly so. It was a wake-up call: we needed a proper test framework.
Initially, I turned to PyTest. Given my past usage, I was able to quickly implement a few core test cases. The team architect reviewed these tests quickly and added a request: once the basic tests were in place, explore Robot Framework as a possible test framework for our data processing which would undoubtedly grow in size and complexity.
I will not go into details on the PyTest implementation as to not make the back story too long. The only thing to note here is that I developed 3 basic test cases using PyTest to establish a few connections in our system and run through basic authentication tests.
Getting to Know Robot Framework
One of the best ways I know to start a new project is to set time aside to properly read through the documentation to get a sense of what I am working with. So for this, I needed to learn why this Framework could benefit our project and if this is even something we can support long-term. We can use factors like complexity, ease of implementation, documentation, and support to make our final decision if we should move ahead with developing a “Hello World” type small scale implementation using our existing tests.
🧠 What I Learned
1. Keyword-Driven Testing
Robot Framework uses a keyword-driven approach to make the scripts more readable. I’m generally not a fan of these sorts of frameworks as they add an unnecessary layer of complexity on top of the native python code. Robot Framework also uses a tabular syntax to build test flows with the ability to have nested keywords. You can create modular, reusable components and nest them, like functions, to execute tests.
2. Built-in Libraries
Robot Framework has many python libraries already built in to their framework which means you can invoke, for example, http requests, by simply using Robot keywords.
3. Automatic Test Reports
Automatic report building. Proper test reports, to me, are important and need to be properly detailed. Robot Framework automatically builds reports at the end of test suite executions and deposits them in the project path. This makes it easy to share results with internal and external parties in a quick way. For example, I can send the automatically generated HTML file to a co-worker.
With these features in mind, I decided to give it a shot and build my Hello World!
Building My First Test Suite
There’s a few features of Robot Framework I wanted to specifically test, such as the nested nature of test suites and supporting resources. What you essentially have is a .robot file, which is the high level suite made up of high level test cases which refer to keywords and functions found within the .resources file.
📁 The .robot
File
*** Settings ***
Resource mqtt-tests-resources.resource
*** Test Cases ***
Get New JWT
[Documentation] Retrieves a JWT from the token service and validates the contents of the payload
Get Jwt https://<site>/api/mqtt/token VIN12345 testdeviceid clientid123 clientkey123
Mqtt Connection
[Documentation] Test connection to MQTT broker
Connect To Mqtt
This file imports a resource file that defines custom keywords, and defines two test cases:
- One to retrieve and validate a JWT
- Another to test connectivity with our MQTT broker
📦 The Resource File
*** Settings ***
Documentation Resource file for the MQTT test suite.
Library TestLibrary.py
*** Keywords ***
Get Jwt
[Documentation] Gets a JWT from the token service
[Arguments] ${URL} ${VIN} ${DEVICE_ID} ${CLIENT_ID} ${CLIENT_KEY}
Test Get Jwt ${URL} ${VIN} ${DEVICE_ID} ${CLIENT_ID} ${CLIENT_KEY}
Connect To Mqtt
[Documentation] Test connection to the MQTT broker
Test Connect Mqtt
This resource file links to a Python library I wrote (based on the PyTest version), and defines two high-level keywords that wrap methods in that library.
Because of confidentiality, I can’t share the full script, but here's the gist of what those methods do:
def test_get_jwt(self, url, vin, device_id, client_id, client_secret):
# Makes HTTP request to auth server
# Parses JWT and asserts expected claims
def test_connect_mqtt(self):
# Attempts MQTT connection and asserts connection is established
Everything ran smoothly. The tests executed, reports were generated, and I could validate the most critical paths in our system without much overhead.
What’s Next?
My next goal is to experiment with using Robot’s built-in HTTP library instead of relying entirely on custom Python code. If I can express some of the simpler tests directly in the .robot
syntax, it might reduce the amount of code I need to maintain.
🧭 My Takeaway
Robot Framework is surprisingly versatile. It's not trying to replace Python but complement it. I see its real strength in:
- Structuring test suites and cases
- Automating reports
- Giving non-developers a way to contribute to test design
For more complex test logic, I’ll still rely on Python. But using Robot Framework as a wrapper and orchestrator is promising for this project.
