Katalon Studio Integration with GitLab CI/CD
For CICD purposues usually a docker image of Katalon is needed which then can be integrated with Katalon Studio.Use the official Katalon Docker image to run your tests in GitLab CI/CD. This image is pre-configured with all necessary dependencies for running Katalon Studio.
The reference of the docker images can be implemented in various cicd products. we will sum them up
- GitLab CI/CD Configuration:
- Create a .gitlab-ci.yml file in your project’s root directory.
katalon-test:
image: katalonstudio/katalon
script:
- katalonc -noSplash -runMode=console -projectPath="path/to/your/project" -retry=0 -testSuitePath="Test Suites/YourTestSuite" -executionProfile="default" -browserType="Chrome (headless)"
- Execution: Commit and push this configuration to your GitLab repository. GitLab CI/CD will automatically use this configuration to run your Katalon tests in the defined Docker container.
Katalon Studio Integration with GitHub Actions
- GitHub Actions Workflow:
- Create a workflow file (e.g., .github/workflows/katalon.yml) in your GitHub repository.
- Use the Katalon Docker image within the workflow to execute your tests.
name: Katalon Studio Test Execution
on: [push]
jobs:
build:
runs-on: ubuntu-latest
container: katalonstudio/katalon
steps:
- uses: actions/checkout@v2
- name: Run Katalon Studio Tests
run: katalonc -noSplash -runMode=console -projectPath="$GITHUB_WORKSPACE" -retry=0 -testSuitePath="Test Suites/YourTestSuite" -executionProfile="default" -browserType="Chrome (headless)"
– Execution: Whenever you push changes to your repository, GitHub Actions will automatically execute the workflow, running your Katalon tests in the process.
Katalon Studio Integration with Jenkins
- Docker Plugin: Ensure your Jenkins setup has the Docker plugin installed to run Docker containers.
- Jenkins Pipeline:
- Create a new Jenkins Pipeline job.
- Use the Pipeline script to define steps that pull the Katalon Docker image and run your tests.
pipeline {
agent {
docker { image 'katalonstudio/katalon' }
}
stages {
stage('Test') {
steps {
sh 'katalonc -noSplash -runMode=console -projectPath="/path/to/your/project" -retry=0 -testSuitePath="Test Suites/YourTestSuite" -executionProfile="default" -browserType="Chrome (headless)"'
- Execution: Run the pipeline to execute your Katalon tests within a Docker container managed by Jenkins.
Katalon Studio Integration with Azure
Prerequisites
- An Azure DevOps account and a project set up.
- Your Katalon Studio project is checked into a repository in Azure DevOps.
- Familiarity with creating pipelines in Azure DevOps.
Steps to Integrate Katalon Studio with Azure DevOps
-. Prepare Your Katalon Studio Project
- Ensure your Katalon Studio project is stored in a Git repository in Azure DevOps.
- Include a Dockerfile in your project if you plan to use a custom Docker image, or ensure that your pipeline is configured to use the official Katalon Docker image directly.
- Create a New Pipeline
- In your Azure DevOps project, go to Pipelines > New pipeline.
- Choose where your code is stored (Azure Repos Git in this case), and select your repository.
- Configure Your Pipeline
You have the option to use the classic editor or YAML to define your pipeline. Here, we’ll focus on the YAML configuration for using Docker.
- Select the YAML option and start configuring your pipeline. You might start with a template or create a new YAML file.
- Add the following steps to your YAML file. This example uses the official Katalon Docker image to execute your tests. Adjust the command line options (katalonc command) according to your project needs.
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
container:
image: katalonstudio/katalon
steps:
- script: |
katalonc -noSplash -runMode=console -projectPath="$(System.DefaultWorkingDirectory)/your-katalon-project-folder" -retry=0 -testSuitePath="Test Suites/YourTestSuite" -executionProfile="default" -browserType="Chrome (headless)" -apiKey="<Your_Katalon_API_Key>"
displayName: 'Execute Katalon Studio Tests'
For all Replace your-katalon-project-folder with the path to your project within the repository, YourTestSuite with the name of your test suite, and <Your_Katalon_licence/api_Key>
- Run Your Pipeline
-
Save and run your pipeline. Azure DevOps will execute the pipeline on the specified trigger, use the Docker container to run your Katalon Studio tests, and report the results back in the pipeline’s run summary. *. Viewing Test Results
-
To better view and analyze test results within Azure DevOps, you might consider exporting test results from Katalon Studio in a format that Azure DevOps can interpret (e.g., JUnit XML) and publishing the test results as part of your pipeline steps. Azure DevOps also allows you to integrate with various extensions and plugins to enhance your CI/CD pipeline’s capabilities, including test result reporting, artifact management, and more.This integration ensures that your Katalon Studio tests are an integral part of your development pipeline, facilitating continuous testing and deployment with Azure DevOps.
Best Practices
- Keep Your Test Scripts Under Version Control: Ensure your Katalon Studio project is under version control with GitLab or GitHub to seamlessly integrate with their respective CI/CD pipelines.
- Manage Test Data and Reports: Configure your CI/CD pipeline to handle test data and store reports. For instance, you can archive test reports as artifacts in GitLab CI/CD or GitHub Actions.
- Optimize Test Execution: Use test suite collections in Katalon Studio to organize and manage the execution of multiple test suites, potentially in parallel, to reduce overall test execution time.