Execute Katalon Studio tests with Jenkins Pipeline Script (Jenkinsfile)
Jenkins Pipeline (Jenkinsfile) provides an extensible set of tools for modeling simple-to-complex delivery pipelines. To learn more about creating a Jenkinsfile, you can refer to this Jenkins document: Using a Jenkinsfile.
Jenkins installed. Follow the instructions in this Jenkins document for installation: Getting started.
Katalon Runtime Engine (KRE) installed. You can download Katalon Runtime Engine here: Katalon products.
An active Katalon Runtime Engine license. To learn more about activating the Katalon Runtime Engine license, you can refer to this document: Activate Katalon License.
This tutorial shows you how to execute Katalon Studio tests in Jenkins with Jenkins Pipeline Script (Jenkinsfile). Follow these steps:
- In the Jenkins Dashboard, go to New Item and create a Jenkins Pipeline project.
-
In the Definition dropdown list, select Pipeline Script.
-
Copy and paste the following command-line arguments in the Script box:
For Windowspipeline {
agent any
stages {
stage('Test') {
steps {
bat """
cd <KRE installed folder>
katalonc -projectPath="<projectpath>" -browserType="<browser>" -retry=<number of retry times> -statusDelay=<seconds> -testSuitePath="<path>" -apiKey="<user API key>" -orgID=<Katalon_OrgID>
"""
}
}
}
}
For example:pipeline {
agent any
stages {
stage('Test') {
steps {
bat """
cd C:\Users\NAH\Desktop\Katalon_Studio_Engine_Windows_64-8.1.0
katalonc -projectPath="C:\Users\NAH\Desktop\ci-samples-master\test.prj" -browserType="Chrome" -retry=0 -statusDelay=15 -testSuitePath="Test Suites/TS_RegressionTest" -apiKey="<user API key>" -orgID=<Katalon_OrgID>
"""
}
}
}
}For macOS/Linuxpipeline {
agent any
stages {
stage('Test') {
steps {
sh '''
cd <KRE installed folder>
./katalonc -projectPath="<projectpath>" -browserType="<browse" -retry=<number of retry time> -statusDelay=<seconds> -testSuitePath="<path>" -apiKey="<user API key>" -orgID=<Katalon_OrgID>
'''
}
}
}
}
For example:pipeline {
agent any
stages {
stage('Test') {
steps {
sh '''
cd /Users/yen.nguyen/Downloads/Katalon_Studio_Engine_MacOS-8.1.0/Katalon\\ Studio\\ Engine.app/Contents/MacOS
./katalonc -projectPath="/Users/yen.nguyen/Downloads/ci-samples-master/test.prj" -browserType="Chrome" -retry=0 -statusDelay=15 -testSuitePath="Test Suites/TS_RegressionTest" -apiKey="<user API key>" -orgID=<Katalon_OrgID>
'''
}
}
}
}Note:You can find more command-line options at Command Syntax.
-
After the configuration, click Save, then click Build Now to run the project.
-
To view the console log, click on your current build on Jenkins and select Console Output.