To all devs- i have created a jenkins job to checkout code from GITHUB and create apk, now need help to run katalon test suite on the apk


#1

I Am still learning jenkins and dev ops, have some challenges and need some help.

I have written the tests for my android app with Katalon studio. I have created a job on Jenkins which does code checkout from git, runs shell commands to create APK.

Now my next challenge is to run the KS test suites on this apk file.

I am clueless on how to start with this task. FYI, i have created the script to run KS test suite from command line. Was able to run the kS test suite but with this process the test suite runs only if a device is connected to my machine and KS is installed.

I want to automate the last two steps, that manual KS installation shouldn’t be a restriction. Should happen from the jenkins shell command maybe

connecting device also shouldn’t be a requirement as if i can use android emulator or some other free online device farm service.

Let me know if I need to detail out something.

command line code: ./Katalon\ Studio.app/Contents/MacOS/katalon --args -noSplash -runMode=console -consoleLog -projectPath="/Users/bm/Katalon Studio/TestFoxy/TestFoxy.prj" -retry=0 -testSuitePath=“Test Suites/Foxy Suite/Suite S01” -executionProfile=“default” -deviceId=“aec4cc69” -browserType="Android"apiKey=“xxxxxxx

EDIT1: I can not get my head around on where to start. For Katalon test job in jenkins I have added a trigger that says run the test as soon as the GIT checkout job finishes. Have hardcoded the path for apk in katalon test case ( let me know if this is best practice). But in the Katalon Job, i have simply created the cmd command and pasted in EXECUTE SHELL step. This triggers the katalon and runs the test.

But i want all of it to happen without manual intervention, say pereodically

@Chris_Trevarthen
@duyluong


#2

Hi @Bal_Mukund,

You can definitely run tests on an emulator instead of a real device, but you’ll need to start the emulator first. You can start an installed emulator from the command line using some commands here: https://developer.android.com/studio/run/emulator-commandline

Hardcoding the path to the APK seems OK to me if it’s not going to change. You can use a relative path in the startApplcation command so it’s not so brittle. I think you could also pass the location of the APK file on the command line, but it’s a bit tricky. Here’s a thread about it: How to pass user defined parameters from command line

As for installing Katalon Studio automatically, you might have luck with running Katalon Studio in a Docker container, as mentioned here: https://docs.katalon.com/katalon-studio/videos/katalon_run_docker_container.html
There’s also a Katalon Jenkins plugin which could take care of that for you: https://wiki.jenkins.io/display/JENKINS/Katalon+Plugin

Hope this helps,

Chris