Skip to main content

OpenShift integration

Note:
  • This workflow is successfully implemented for some of our customers. Please note that the results can vary depending on individual configurations.

Running Katalon Studio tests in OpenShift provides a flexible and scalable solution for automated testing. This setup is useful for various scenarios, including:
  • Creating consistent test environments using OpenShift Container Platform.

  • Automating test execution as part of a CI/CD pipeline.

  • Efficiently managing and scaling test resources.

This guide demonstrates how to integrate automated testing into your OpenShift process.

Requirements

Run Katalon tests in OpenShift

Below is the process for running Katalon tests in an OpenShift cluster. This includes gaining access to OpenShift, creating a custom Docker image for Katalon, and deploying the job using the CLI. Follow these steps to set up your environment and run your tests efficiently.

Log in to OpenShift
  1. Open a terminal and input crc start.
    The output will provide login information for the OpenShift and the oc command line interface.
  2. Log in to your OpenShift cluster.
    1. Configure the oc command line interface by running this command:
      eval $(crc oc-env)
    2. Log in to OpenShift as an administrator using the provided credentials.
      oc login -u kubeadmin -p <admin-password> https://api.crc.testing:6443
Create a custom Docker Image for Katalon
  1. Create a directory for your custom image by running these commands:
    mkdir ~/katalon-custom-image
    cd ~/katalon-custom-image
  2. Create a file named Dockerfile in the terminal.
    nano Dockerfile
    Then, add the following content:
    FROM katalonstudio/katalon
    USER root
    RUN apt-get update && \
    apt-get install -y libxi6 libgconf-2-4 libstdc++6 xvfb && \
    rm -rf /var/lib/apt/lists/*
    USER katalon
    Save the file and exit the text editor (press Ctrl+X, then Y, and then Enter).
  3. Build the Docker Image.
    docker build -t katalon-custom .
  4. Tag and push the Docker Image.
    docker tag katalon-custom <dockerhub-username>/katalon-custom:latest
    docker push <dockerhub-username>/katalon-custom:latest
Deploy and run your Katalon tests in the OpenShift cluster
  1. Open Visual Studio Code and create a YAML file for the Katalon job.
    For example, a file named katalon-job.yaml with the following content:
    apiVersion: batch/v1
    kind: Job
    metadata:
    name: katalon-job
    spec:
    template:
    spec:
    containers:
    - name: katalon
    image: <dockerhub-username>/katalon-custom:latest
    command:
    - /bin/bash
    - -c
    args:
    - |
    echo "Starting Git Clone" && \
    git clone <your-github-url> /tmp/katalon_execute/project && \
    echo "Git Clone Completed" && \
    cd /tmp/katalon_execute && \
    katalonc.sh -browserType=Chrome -retry=0 -statusDelay=15 -testSuitePath="Test Suites/TS_RegressionTest" -apiKey=<your-apikey> --config -webui.autoUpdateDrivers=true -runMode=console -reportFolder=/tmp/katalon_execute/report -projectPath=/tmp/katalon_execute/project/test.prj -logLevel=DEBUG
    resources:
    limits:
    cpu: 2
    memory: 4Gi
    requests:
    cpu: 1
    memory: 2Gi
    restartPolicy: Never
    backoffLimit: 4
    Note: The resources section in the YAML file specifies the CPU and memory requests and limits for the job. Adjust these values based on the available resources in your OpenShift cluster and the requirements of your Katalon tests.
  2. Apply the YAML file using the following CLI command in the terminal:
    oc apply -f ~/katalon-job.yaml
    This command deploys the job configuration defined in the katalon-job.yaml file to the OpenShift cluster.
  3. Get the list of pods.
    oc get pods
    This command will display a list of all pods along with their names and statuses.
  4. View the logs of the pod.
    oc logs -f <pod-name>
    Replace <pod-name> with the actual name of the pod. This command will allow you to follow the logs live as the pod runs.
Upon the pod completing its run, you should see the following output indicating the successful test execution:

View the Katalon job in the OpenShift web console

You can also view the Katalon job in the OpenShift web console by accessing the URL provided after starting CRC, for example, https://console-openshift-console.apps-crc.testing.

  1. Log in using the provided credentials when starting CRC.
  2. Open Workloads > Jobs and search your job's name.
  3. Inside the Jobs, click Pods to see the list of your pods.
  4. Inside the Pods, you can see the Status is Running.
  5. Click Logs to view the progress of the job.
Was this page helpful?