Skip to main content

Running Gwen in Jenkins

The easiest way to get Gwen running in Jenkins is to push your project to a Git repository and get it running in Docker.

Then it's just a matter of calling docker-compose run gwen in your Jenkins job or pipeline. Everything including a Selenoid browser environment and Gwen itself (and all it's dependencies) will then get spinned up and run.

Pipeline job

To run your Gwen project in a Jenkins pipeline:

  1. Create a Jenkinsfile file in the root of your Gwen project.
/project                    # Your project root
└── Jenkinsfile # Jenkins pipeline script file
  1. Save the following content into the file.
pipeline {
agent {
// an agent with docker installed
label 'docker-agent'
}
stages {
stage("Prepare") {
steps {
script {
sh 'mkdir -p gwen/output'
}
}
}
stage("Gwen") {
steps {
script {
// Spin up environment and execute Gwen in docker
sh "docker-compose run gwen"
}
}
post {
always {
sh "docker-compose down"
archiveArtifacts artifacts: 'gwen/output/reports/**'
publishHTML(target: [
allowMissing : false,
alwaysLinkToLastBuild: false,
keepAll : true,
reportDir : "gwen/output/reports/html",
reportFiles : 'index.html',
reportName : "Gwen-Report"
])
}
}
}
  }
}
  1. Push or commit your project to a Git repostitory

  2. Create a new pipeline job in Jenkins and perform the following in the Pipeline configuration section:

    • Checkout your Gwen project from Git
    • Specify the Jenkinsfile above as the script
    • Save the job
  3. Schedule or run the job in Jenkins

    • Evaluation reports will be generated and published to each job execution (Gwen-Report links)