Test scripts created on Window Katalon platform, But I want to run on Linux OS using Jenkins

Please suggest how we can achieve this. Can we directly give the command line prompt from “Build CMD” to Linux Jenkins configuration and put all the relevent project files in the Linux machine.

My query is Linux Katalon executable will be able to run test suite of Window Katalon created scripts?

1 Like

Sachin Girdhar said:

Please suggest how we can achieve this. Can we directly give the command line prompt from “Build CMD” to Linux Jenkins configuration and put all the relevent project files in the Linux machine.

My query is Linux Katalon executable will be able to run test suite of Window Katalon created scripts?

Hi Sachin Girdhar,

I have the same issue. If you done, you can send me guide document. Thank you very much.

Just read the tutorial.
This is how do I use Jenkins on Linux machine, where all tests are made also on a Linux environment:
Jenkins - Build as Execute shell

cd /home/dev/Documents/Katalon/
KATALON="./katalon -runMode=console -projectPath="/home/dev/jenkins-workspace/workspace/tests/TEST.prj" -reportFolder="Reports" -consoleLog -summaryReport"
$KATALON -testSuiteCollectionPath="Test Suites/BasicOperations/BasicOperations" || error=true


#Fail the build if there was an error
if [ $error ]
then 
    exit -1
fi

My approach for a similar case is like this:

- once the project is finaly set-up on windows, I push it to git (and remove some files not needed, like libs directory and so on)
- from Jenkins, grab the project and run it using the docker image on a linux executor

To achieve this, i do as follows:

- in the Source Code management I set up the repo where my project is pushed
- next, i am setting up some environment variables, using the “inject environment variables” plugin > groovy script. the code I put in there looks like this

def TODAY = new Date().format('YYYY_MM_dd')
def REPORT_DIR = "${TEST_SUITE_NAME}_${TEST_ENV}_${TODAY}.${BUILD_NUMBER}"
def TS_PATH = "Test\\ Suites/TS_$TEST_SUITE_NAME"
def katalon_opts = "-browserType='Chrome' -retry=0 -statusDelay=15 -consoleLog -testSuitePath=$TS_PATH -executionProfile=$TEST_ENV"
return [
    katalon_opts: katalon_opts,
    REPORT_DIR : REPORT_DIR
] 

This is not mandatory, those variables can be defined straight in the execute shell step or simply not used (use the codes straight in the cmd, skip what is not needed for you)

The ${TEST_SUITE_NAME} and ${TEST_ENV} variables are set in the “This project is parametrized” section part, since I want to execute this job with different scenarios (suites and predefined profiles) and I want also the report to be generated into a custom named folder (at the end of the execution I am uploading the html one to an apache server, but that part is a different story)

-next, into an “execute shell” step, I have a script like this:

mkdir $REPORT_DIR
docker run --rm --name katalon \
-v $(pwd)/path_to_project:/katalon/katalon/source:ro \
-v $(pwd)/$REPORT_DIR:/katalon/katalon/report \
-e KATALON_OPTS="$katalon_opts" katalonstudio/katalon:5.7.0

replace the “path_to_project” to your case, depending how is set into your VCS.

also you can simply use the katalonstudio/katalon without specifying the version tag, if you want to always use the latest docker image.

That’s all. Hope it helped!