In the Jenkinsfile I would like to use an existing Robot framework docker image. The Docker image that is pretty complete for browser testing is: ppodgorsek/robot-framework
An example of the use is:
docker run \
-v <local path to the reports' folder>:/opt/robotframework/reports:Z \
-v <local path to the test suites' folder>:/opt/robotframework/tests:Z \
ppodgorsek/robot-framework:<version>
How can I start a Robot Framework test?
Something like this? I dont have idea how robotframework works :)
pipeline {
agent {
docker {
image 'ppodgorsek/robot-framework'
}
}
stages {
stage('Checkout') {
steps {
git branch: "master", credentialsId: "jenkins-key", url:'ssh://git@github.org/mysupercode/'
}
}
stage('Test') {
steps{
sh 'do_super_tests.sh'
}
}
}
post {
always {
archive (includes: 'mytestfolder/mytest.html')
}
}
}
Solution-1: thanks to @parasit I found 'ppodgorsek/robot-framework'.
You can start a Robot Framework test from a Jenkinsfile with this pipeline code:
pipeline {
agent any
stages {
stage('Checkout') {
steps {
git branch: "master", url:'https://github.com/johan974/robot-framework-demo1.git'
}
}
stage('Test') {
steps{
sh 'docker run -v ${PWD}/reports:/opt/robotframework/reports:Z -v ${PWD}/Tests:/opt/robotframework/tests:Z \
-e BROWSER=chrome ppodgorsek/robot-framework:latest'
}
}
}
post {
always {
archive (includes: 'reports/*.html')
}
}
}
If you have these steps (including post), then you can find the results in the famous log.html en report.html files as shown below:
If you face problems showing the RF results, you can execute the followin script in your Jenkins > 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' ;")
UPDATE-2: using the much smaller Robot Framework image I could start Robot Frameworkrunning. It complains about the chromedriver not installed. This script is shown below. It could be enough when you don't have to test using a browser.
pipeline {
agent {
docker {
image 'manycoding/robotframework'
}
}
stages {
stage('Checkout') {
steps {
git branch: "master", url:'https://github.com/johan974/robot-framework-demo1.git'
}
}
stage('Test') {
steps{
sh 'chmod a+x ./run-tests.sh && ./run-tests.sh'
}
}
}
post {
always {
archive (includes: 'reports/*.html')
}
}
}