
The Jenkins CI/CD tool is one of the most well-known applications used to create continuous delivery/deployment pipelines.
Jenkins pipeline provides an extended set of tools for modeling anything from simple to complex delivery pipelines as code. The definition or code of a Jenkins pipeline is written into a text file named "Jenkinsfile" which in turn is checked into a project’s source control repository.
Below is sample code for a declarative pipeline:
pipeline {
agent { label 'node_name' }
stages {
stage('Source') {
steps {
// get code from repository
git ' repo URL' //URL of your repo
}
}
stage('Compile') { // Compile and perform unit testing
tools {
gradle 'gradle'
}
steps {
// run gradle commands to compile and unit testing
sh 'gradle clean compileJava tests'
}
}
}
}
agent { label 'node_name' }
stages {
stage('Source') {
steps {
// get code from repository
git ' repo URL' //URL of your repo
}
}
stage('Compile') { // Compile and perform unit testing
tools {
gradle 'gradle'
}
steps {
// run gradle commands to compile and unit testing
sh 'gradle clean compileJava tests'
}
}
}
}
If you need further assistance with using Jenkins for test automation, or need to extend your QA resources and capabilities, contact QASource today.
Post a Comment