Running a Robot Framework Test on GitLab and Deploying the Report

Pradap Pandiyan
4 min readNov 9, 2022

--

One of the coolest features of the robot framework is codeless automation. But we cannot say that it's 100% of codeless automation because when you have a shortage of keywords, you need to write it in python to fill the gap.

The robot framework code might be simple to execute and it has a lot of libraries that can fulfill the actual code automation. Once the code is completed we need to run it on the CI. A great part of the robot framework is having the support to run with multiple CI tools.

I’ve created two tests with a successful case and a failed case and added them to the CI.

Reporting
The good part about the robot framework is to have the inbuilt feature of having a test report generated within. It also has a failure screenshot of the failed steps. The robot framework generates 3 files and also screenshots when there is a failure.

  1. log.html
  2. output.html
  3. report.html

The architecture of the Robot framework is very simple because it has only .robot file and there is no specific configuration we need to do other than installing the libraries using pip commands.

*** Settings ***
Library SeleniumLibrary

Test Teardown Close All Browsers

*** Test Cases ***
open chrome browser for medium - Open Browser
Open Browser https://pradappandiyan.medium.com/ headlesschrome
set window size 1280 800
input text //input[@placeholder="Search"] "How to Handle OTP Verification on Test Automation"

open chrome browser for linkedln - Open Browser
Open Browser https://www.linkedin.com/in/pradap-pandiyan/ headlesschrome
set window size 1280 800
click element //svg[@xmlns:xlink="http://www.w3.org/1999/xlink"]

I’ve added the test to run on a headless browser with a parameter added called headlesschrome in open browser.

I’m running the test on a gitlab CI and created a .gitlab-ci.yml file on the project root folder.

We can create a custom docker image to run the following browsers. Some are difficult to get to a docker image because of the restriction.

  1. Firefox firefox, ff
  2. Google Chrome googlechrome, chrome, gc
  3. Headless Firefox headlessfirefox
  4. Headless Chrome headlesschrome
  5. Internet Explorer internetexplorer, ie
  6. Edge edge
  7. Safari safari
  8. Opera opera
  9. Android android
  10. Iphone iphone
  11. PhantomJS phantomjs
  12. HTMLUnit htmlunit
  13. HTMLUnit with Javascript htmlunitwithjs

In GitLab, I’ve created a single stage to execute the test as part of a step. In this step, I’ve added a docker image to run the test with the help of a public docker image. Here is the docker image link.

stages:
- test

test:
image: ppandiyan/robotframework
stage: test
script:
- robot --outputdir testOutput Test.robot
artifacts:
when: always
paths:
- testOutput
expire_in: 1 day

I’ve added an artifact as part of the step with an expiry of one day. Once the test is executed it will deploy the report in the GitLab artifact and we can easily view the report in the artifact. If the test fails it will have the failure screenshot as well as part of the artifact

artifacts

Once the CI is executed we can see the log and path of the executed test. The CI job will show green if we execute the pass status for all the tests.

GitLab log

The log report is very comprehensive on logs, screenshots, execution time, stats, etc

log report

The summary report helps in summarizing the overall test suites. When we execute multiple test suites and tests, it will give the overall execution report.

summary report

I’ve created the project and uploaded it in Gitlab with CI integration, feel free to check here.

I’m planning to create a new blog for the execution of the test in the command line. Commandline plays a major role in the Robot Framework for customizing the test.

Feel free to hit clap if you like the content. Happy Automation Testing :) Cheers. 👏

--

--

Pradap Pandiyan
Pradap Pandiyan

Written by Pradap Pandiyan

I’m a passionate QA Engineer. I’m a motovlogger, content creator, off-roader and freelancer. Buy me a coffee here https://www.buymeacoffee.com/pradappandiyan

No responses yet