如何在非本地服务器的Jenkins上执行GitHub存储的Katalon测试套件?
Absolutely! You can absolutely run your Katalon test suite on a non-local Jenkins server, and configuring it to pull your test suite directly from GitHub is totally feasible. Let me break down the setup process for you:
Prerequisites First
Before diving in, make sure your remote Jenkins server meets these requirements:
- Java Runtime Environment (JRE) installed (Katalon depends on Java)
- If your tests require a GUI (like browser-based tests), you’ll need a virtual display solution (e.g., Xvfb for Linux servers)
- Either Katalon Studio installed on the server, or use the Katalon Runtime Engine (KRE) (recommended for CI/CD workflows since it’s designed for headless execution)
Step 1: Configure Jenkins to Access Your GitHub Repository
First, you need to give Jenkins permission to pull code from your GitHub repo:
- Go to your Jenkins dashboard → Manage Jenkins → Manage Credentials
- Add a new credential of type Secret text:
- Paste your GitHub Personal Access Token (PAT) (make sure it has repo access permissions)
- Set an ID and description for easy reference (e.g.,
github-repo-access)
- Create a new Jenkins project (Freestyle or Pipeline):
- For Freestyle: Go to Source Code Management → Select Git → Paste your GitHub repo URL → Choose the credential you just added → Specify the branch you want to pull (e.g.,
mainormaster) - For Pipeline: Use a
gitstep in your Jenkinsfile to pull the repo with the credential, like this:stage('Checkout Code') { steps { git url: 'https://github.com/your-username/your-katalon-repo.git', credentialsId: 'github-repo-access', branch: 'main' } }
- For Freestyle: Go to Source Code Management → Select Git → Paste your GitHub repo URL → Choose the credential you just added → Specify the branch you want to pull (e.g.,
Step 2: Set Up Katalon Execution in Jenkins
Next, configure Jenkins to run your Katalon test suite:
Option 1: Use Katalon Runtime Engine (Recommended)
KRE is lighter and built for CI/CD. You can run it via Docker (no manual installation needed):
Add a build step (shell script for Linux, batch for Windows) with this command:
docker run -v $(pwd):/katalon/katalon/source katalonstudio/katalon katalon-execute.sh \ -browserType="Chrome" \ -retry=0 \ -statusDelay=15 \ -testSuitePath="Test Suites/YourTestSuiteName"
- The
-vflag mounts your checked-out repo into the Docker container so Katalon can access the test suite. - Adjust
browserTypeandtestSuitePathto match your project’s settings.
Option 2: Use Katalon Studio
If you prefer using the full Katalon Studio on the server:
- Install Katalon Studio on the remote Jenkins server
- Add a build step with this command (adjust paths to match your setup):
katalon -noSplash -runMode=console -consoleLog \ -projectPath="/var/lib/jenkins/workspace/your-project/your-katalon-project.prj" \ -testSuitePath="Test Suites/YourTestSuiteName" \ -browserType="Chrome"
Step 3: Handle GUI Tests on Headless Servers
If your tests use a browser (like Chrome/Firefox), remote Linux servers won’t have a default display. Fix this with Xvfb:
- Install the Xvfb Plugin in Jenkins (via Manage Jenkins → Plugins)
- In your project configuration, check the box: Start Xvfb before the build, and shut it down after
- This creates a virtual display for the browser to run on, so your tests won’t fail due to missing GUI.
Step 4: Verify & Archive Results
After setting up, run a test build to confirm:
- Jenkins successfully pulls your test suite from GitHub
- Katalon executes the tests without errors
- Configure Jenkins to archive test reports (in Freestyle: Post-build Actions → Archive the artifacts; in Pipeline: Use
archiveArtifactsstep) so you can review results later.
内容的提问来源于stack exchange,提问作者roinrb

