This repo is for demo purposes and to have a reference setup for learning and playing around with Jenkins and Robotframework.
This reference can also be used if you have your own installation of Jenkins with robotframework installed on a node, but for ease of use some steps to have a working installation running in docker is included, together with a Dockerfile.
If you already have a working Jenkins please skip to the section Configure Jenkins for Robotframework.
Build your container including robotframework:
docker build -t demo-jenkins:latest .
Spin up your jenkins installation:
docker run --rm -p 8080:8080 -p 50000:50000 -v jenkins_home:/var/jenkins_home demo-jenkins:latest
Now connect to your jenkins by putting the next link into your browser: http://localhost:8080
Follow the steps following the execution of the first command to the screen "Jenkins is ready!" from this Tutorial: Quick tutorial of Jenkins
Getting started with Robotframework on Jenkins:
- Manage Jenkins -> Manage Plugins
- Search for Robotframework
- Install
- New Item
- Freestyle project
- Source Code Management -> Git
- Fill in the details for your repo
- Build -> Add Build Step -> Execute Shell
- Fill in the command to run robotframework:
robot -d results -i intake rf-tests
- Fill in the command to run robotframework:
- Post-Build Actions -> Publish Robot Framework test results
- Fill in the folder where the results go
- Fill in the thresholds
- Save and run your Job
- New Item
- Pipeline
- Pipeline -> Definition -> Pipeline script from SCM
- SCM -> Git and fill in the details
- Script path -> set path to Jenkinsfile
- Define the stages and steps in your Jenkinsfile (see example included Jenkinsfile)
- Save and run your Job
To show reports you need to run the following script in the Script Console (Open via: Manage Jenkins -> Script Console)
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP","sandbox allow-scripts; default-src 'none'; img-src 'self' data: ; style-src 'self' 'unsafe-inline' data: ; script-src 'self' 'unsafe-inline' 'unsafe-eval' ;")
Using Jenkins in Docker: https://medium.com/@gustavo.guss/quick-tutorial-of-jenkins-b99d5f5889f2
Setting up a Freestyle project for RF-tests https://medium.com/faun/setting-up-your-jenkins-machine-to-execute-robot-framework-automation-tests-a98b3e599119