Sending a Different Exit Code of Katalon executable (Katalon/BrowserStack/Jenkins)

Hey guys,

I’m using Jenkins and Browserstack with Katalon executable to do automated testing. My test suite is 10 different test cases of checking out a product on our website. Some test cases instantly fail when opening the browser and send an unwanted exit code to Jenkins saying the whole suite failed. Currently the browser that fails is Edge 18.0 but there’s not much I can do to prevent it from failing. I’ve tried changing the failure handling when opening the browser to OPTIONAL but it still has a error result.

Is there any way to send an exit code inside of Katalon script so that Jenkins sees an exit code of 0 instead of 1-4? The point of the tests are to make sure our website runs properly and shouldn’t fail when the browser fails. This could also apply to other times the website works properly but something else goes wrong. Thank you for taking the time to read this.

This is what I have inside of Jenkins:

sh runTest.sh “Test Suites/Checkout/Checkout - Single Item” “browserstack - desktop edge”

Here is my executable runTest.sh:

sudo chown jenkins -R ./
sudo chmod 777 -R ./

SCRIPTPATH="$( cd “$(dirname “$0”)” ; pwd -P )"
sudo xvfb-run -a /var/Katalon/Katalon_Studio_Linux_64-5.7.1/katalon -noSplash -runMode=console -consoleLog -projectPath="$SCRIPTPATH/katalon_tests/Katalon Tests.prj" -retry=0 -testSuitePath="$1" -executionProfile=“default” -browserType="$2"
exitCode=$?
echo exitCode=$exitCode
exit $exitCode

Any help would be appreciated!

1 Like