Last Updated On
This tutorial explains the steps to create a GitHub Action for the Robot Framework in Python and execute the tests in that workflow.
Table of Contents
Why GitHub?
GitHub serves as a collaborative platform that supports version control, code collaboration, automated testing, and issue tracking, all of which are crucial elements in the software testing process. It promotes transparency, collaboration, and efficiency in the development and testing workflows.
CI/CD pipelines have contributed to the success of the DevOps cycle in all software development projects. This is a holistic process that bridges development and operations. Continuous integration helps development teams deploy code efficiently, and continuous delivery automates code deployment.
Implementation Steps
Step 1 – Create GitHub Actions and Workflows
I have a repository available in GitHub – RobotFramework_POM as shown in the below image. Go to the “Actions” tab. Click on the “Actions” tab.
![](https://qaautomation.expert/wp-content/uploads/2024/01/image-22.png?w=1200)
Step 2 – Select the type of Actions
You will see that GitHub recommends Actions depending on the project. In our case, it is recommending actions suitable for a Java project. I have selected the “Python application” option as my project is built in Maven.
![](https://qaautomation.expert/wp-content/uploads/2024/01/image-23.png?w=1200)
Step 3 – Generation of Sample pipeline
If you choose an existing option, it will automatically generate a .yaml for the project as shown below.
![](https://qaautomation.expert/wp-content/uploads/2024/01/screenshot-2024-01-02-150143.png?w=1200)
We will replace the current workflow with the following yml file as shown below:
name: Robot Framework - Python
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12.1
uses: actions/setup-python@v3
with:
python-version: 3.12.1
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install robotframework
pip install robotframework-seleniumlibrary
- name: Test with RobotFramework
run: robot .
- name: Test Report Generation
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: Report # Name of the folder
path: report.html # Path to test results
This command will update the Python’s Pip version to the latest available.
python -m pip install --upgrade pip
As we need robotframework and seleniumlibrary to execute the tests, we have installed them also using the below command:
pip install robotframework
pip install robotframework-seleniumlibrary
Step 4 – Commit the changes
After the changes, hit the “Start Commit” button.
![](https://qaautomation.expert/wp-content/uploads/2023/12/image-113.png?w=580)
This will give the option to add a description for the commit. It will also enable the user to commit either to the main branch or commit to any other branch that exists in the project. Click on the “Commit new file” button to set up the workflow file.
![](https://qaautomation.expert/wp-content/uploads/2023/12/image-114.png?w=480)
It will create a python-app.yml file as shown below in the project.
![](https://qaautomation.expert/wp-content/uploads/2024/01/image-24.png?w=1200)
Step 5 – Verify that the workflow is running
Next, head over to the “Actions” tab, and you will see your YAML workflow file present under the tab. The yellow sign represents that the job is in the queue.
![](https://qaautomation.expert/wp-content/uploads/2024/01/image-25.png?w=1200)
In Progress – When the job starts building and running, you will see the status change from “Queued” to “In progress”.
![](https://qaautomation.expert/wp-content/uploads/2024/01/image-26.png?w=1200)
Passed – If the build is successful, you will see a green tick mark.
![](https://qaautomation.expert/wp-content/uploads/2024/01/image-27.png?w=1200)
Below is the execution log. Go to “Test with RobotFramework” phase.
![](https://qaautomation.expert/wp-content/uploads/2024/01/image-28.png?w=1200)
Click on the workflow and the below screen is displayed. It shows the status of the run of the workflow, the total time taken to run the workflow, and the name of the .yml file.
Below shows all the steps of the workflow.
![](https://qaautomation.expert/wp-content/uploads/2024/01/image-29.png?w=1200)
Step 6 – Published Test Report on GitHub
From the logs of the Workflow, you can see that the Test Report step was executed successfully.
![](https://qaautomation.expert/wp-content/uploads/2024/01/image-30.png?w=972)
Once the pipeline run, a Report folder will be generated as shown in the below image:
![](https://qaautomation.expert/wp-content/uploads/2024/01/image-31.png?w=1200)
When we click on the folder Report, a zipped file will be downloaded, and we can extract it to see all the files contained within it.
![](https://qaautomation.expert/wp-content/uploads/2024/01/image-32.png?w=489)
Extract the folder and see the report.html.
![](https://qaautomation.expert/wp-content/uploads/2024/01/image-33.png?w=809)
Below is the image of report.html.
![](https://qaautomation.expert/wp-content/uploads/2024/01/image-34.png?w=1000)
The complete code can be found here on GitHub – vibssingh/RobotFramework_POM.
Congratulations! We just created our CI workflow for running our Python Robot Framework.