Katalon CI help

Hello
i would like to know which commands to use to run a script in CI.

I remember a month ago i was using
katalon-execute. sh ******* and it was working but now it is being said it has deprecated from 7.0 though i am using version 7.5.
Should i use the one generated in the katalon gui?
Thanks

@kazurayam,

Hello,

I have write the command but it is giving me the below error in the pipeline.
Activating…
Start activating offline…
Search for valid offline licenses in folder: /root/.katalon/license
The number of valid offline licenses: 0
Offline activation failed.
Start activating online…
Machine quota exceeded.
Cleaning up workspace
Opening project file: home/anuradha/Katalon Studio//projectname.prj
Invalid argument: Cannot find project 'home/anuradha/Katalon Studio/
/projectname.prj’.
All launchers terminated

  • ret_code=4
  • exit 4
    Uploading artifacts for failed job
    00:01
    Uploading artifacts…
    WARNING: report/*.xml: no matching files
    ERROR: No files to upload
    ERROR: Job failed: exit code 1

I am using an online license and my script is:

katalonc.sh -noSplash -runMode=console -projectPath=“************" -retry=0 -testSuitePath="Test Suites/” -executionProfile=“xxxx” -browserType=“Chrome (headless)” -apiKey=“xxxxxxxxxxxxxxxxxxxxxxxxx”

I have only one registered machine:

@ThanhTo

Could you join?

Did you generate that command line from Katalon Studio ? Seems unlikely that the generated path is wrong, please try to use Command Generator instead of writing your own command.

Hi @ThanhTo, the one generated from KS is:
./katalonc -noSplash -runMode=console -projectPath="/home/anuradha/Katalon Studio/project.prj" -retry=0 -testSuitePath=“Test Suites/” -executionProfile=“xxxxx” -browserType=“Chrome (headless)” -apiKey=“xxxxxxxxxxxxxxxxxxxxxxxxxx” --config -proxy.auth.option=NO_PROXY -proxy.system.option=NO_PROXY

I am trying to put the script in yml file thats where i have having the issue when running in pipeline.
If i navigate to my KRE folder and run the command it works fine.
Only having the issue with integrating it in gitlab CI.

Try:
katalonc.sh -projectPath="/home/anuradha/Katalon Studio/project.prj" -retry=0 -testSuitePath=“Test Suites/” -executionProfile=“xxxxx” -browserType=“Chrome (headless)” -apiKey=“xxxxxxxxxxxxxxxxxxxxxxxxxx” --config -proxy.auth.option=NO_PROXY -proxy.system.option=NO_PROXY

Also try it without the projectPath, I am not sure. You can try to use your old command but replacing katalon-execute.sh with katalonc.sh.

I tried with katalon-execute.sh it is working but if i use katalonc.sh it fails.
when i use katalonc.sh it gives me an error with machine quota which i seems really weird.
Now what i have observed that in gitlab my machine id is different from what is displayed when i run the command from kse folder. Is it normal?

if i try without projectPath it says projectPath not found for katalonc.sh
But when i run with katalon-execute.sh it does not ask me to add the projectPath.
I use this script:
katalon-execute.sh -retry=0 -testSuitePath=“Test Suites” -executionProfile=“xxxxxx” browserType=“Chrome (headless)” -apiKey=“xxxxxxx”
Also i found an article saying that katalon-execute.sh is deprecated so i wanted to use the new command.
@ThanhTo

Hello @ThanhTo @kazurayam,

I have cloned my project and running it in a separate gitlab account.
I am using katalon-execute.sh as i cannot find any luck with katalonc.

Now i think all my object repositories are not detected in the gitlab CI.

I am getting this error : Cannot find elements when the selector is null

Any advise on how i can resolve this.

Thank you

Also i don’t get why i am getting machine quota exceeded everytime when i am running the tests in CI.

I have an online license i should be able to run my tests.
Also why is this part blank in my account:

Under registered machines i can find my machine but here no.

Hello, anyone there? i really need to get this work please.

Please share the execution log. This is related to your script, not the Gitlab nor Katalon issue.

chromeDriver was started successfully.
--------------------------------------------------------------------------------
Test Suites/Generic_Test_Cases/App_Flow - Chrome (headless) - 20200818_140443…
…0/19(0%)
--------------------------------------------------------------------------------
[1597759503.966][WARNING]: This version of ChromeDriver has not been tested with Chrome version 84.
Aug 18, 2020 2:05:04 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
2020-08-18 14:05:04.787 INFO c.k.k.core.webui.driver.DriverFactory - sessionId = b4188bdbc5ba14ea92042ffee51848ee
2020-08-18 14:05:04.845 INFO c.k.k.core.webui.driver.DriverFactory - browser = Chrome 84.0.4147.105
2020-08-18 14:05:04.851 INFO c.k.k.core.webui.driver.DriverFactory - platform = Linux
2020-08-18 14:05:04.854 INFO c.k.k.core.webui.driver.DriverFactory - seleniumVersion = 3.141.59
2020-08-18 14:05:04.869 INFO c.k.k.core.webui.driver.DriverFactory - proxyInformation = ProxyInformation { proxyOption=NO_PROXY, proxyServerType=HTTP, username=, password=****, proxyServerAddress=, proxyServerPort=0, executionList="", isApplyToDesiredCapabilities=true }
2020-08-18 14:05:04.911 DEBUG testcase.11.0 Open Browser - 2: navigateToUrl(base_URL)
2020-08-18 14:05:11.560 DEBUG testcase.11.0 Open Browser - 3: maximizeWindow()
--------------------------------------------------------------------------------
Test Suites/Generic_Test_Cases/App_Flow - Chrome (headless) - 20200818_140443…
…0/19(0%)
--------------------------------------------------------------------------------
2020-08-18 14:05:13.836 INFO c.k.k.c.c.internal.VideoRecorderService - Video recording for test case ‘Test Cases/Generic Test Cases/11.0 Open Browser’ .
Video recording for test case ‘Test Cases/Generic Test Cases/11.0 Open Browser’ .
2020-08-18 14:05:13.850 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/Generic Test Cases/11.0 Open Browser
2020-08-18 14:05:13.872 INFO c.k.katalon.core.main.TestCaseExecutor - --------------------
2020-08-18 14:05:13.873 INFO c.k.katalon.core.main.TestCaseExecutor - START Test Cases/Generic Test Cases/13.0 Inscription/ChoisirOffre
Start recording video for test case ‘Test Cases/Generic Test Cases/13.0 Inscription/ChoisirOffre’.
2020-08-18 14:05:14.530 DEBUG testcase.ChoisirOffre - 1: navigateToUrl(base_URL + “inscription/” + “offres”)
2020-08-18 14:05:15.609 DEBUG testcase.ChoisirOffre - 2: click(findTestObject(“Generic Test Object/12.0 InscriptionCompte/ChoisirOffre/VoirlesOffre”))
--------------------------------------------------------------------------------
Test Suites/Generic_Test_Cases/App_Flow - Chrome (headless) - 20200818_140443…
…1/19(5%)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Test Suites/Generic_Test_Cases/App_Flow - Chrome (headless) - 20200818_140443…
…1/19(5%)
--------------------------------------------------------------------------------
2020-08-18 14:05:46.878 INFO c.k.k.c.webui.common.WebUiCommonHelper - Unable to find the element located by ‘By.xpath: (//[@class=‘btn btn-primary’])[2]’. Please recheck the objects properties to make sure the desired element is located.
2020-08-18 14:05:46.882 WARN c.k.k.c.webui.common.WebUiCommonHelper - [SELF-HEALING] Failed to find element with id ‘Object Repository/Generic Test Object/12.0 InscriptionCompte/ChoisirOffre/VoirlesOffre’. Try using Self-healing.
2020-08-18 14:05:47.924 INFO c.k.k.c.webui.common.WebUiCommonHelper - [SELF-HEALING] No working XPath is found.
2020-08-18 14:05:48.950 INFO c.k.k.c.webui.common.WebUiCommonHelper - Unable to find the element located by 'By.xpath: '. Please recheck the objects properties to make sure the desired element is located.
2020-08-18 14:05:48.978 WARN c.k.k.c.webui.common.WebUiCommonHelper - [SELF-HEALING] Cannot find elements when the selector is null
2020-08-18 14:05:49.401 ERROR c.k.k.core.keyword.internal.KeywordMain - :x: Unable to click on object ‘Object Repository/Generic Test Object/12.0 InscriptionCompte/ChoisirOffre/VoirlesOffre’ (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to click on object ‘Object Repository/Generic Test Object/12.0 InscriptionCompte/ChoisirOffre/VoirlesOffre’
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:76)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:43)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$2.call(Unknown Source)
at ChoisirOffre.run(ChoisirOffre:20)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:339)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:330)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:309)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:301)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:235)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:191)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:141)
at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:90)
at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)
at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
at TempTestSuite1597759483097.run(TempTestSuite1597759483097.groovy:39)
Caused by: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Generic Test Object/12.0 InscriptionCompte/ChoisirOffre/VoirlesOffre’ located by '(//
[@class=‘btn btn-primary’])[2]’ not found
at com.kms.katalon.core.webui.common.WebUiCommonHelper.findWebElement(WebUiCommonHelper.java:1368)
at com.kms.katalon.core.webui.keyword.internal.WebUIAbstractKeyword.findWebElement(WebUIAbstractKeyword.groovy:27)
at com.kms.katalon.core.webui.keyword.internal.WebUIAbstractKeyword.findWebElement(WebUIAbstractKeyword.groovy:26)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.doCall(ClickKeyword.groovy:67)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword$_click_closure1.call(ClickKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.click(ClickKeyword.groovy:76)
at com.kms.katalon.core.webui.keyword.builtin.ClickKeyword.execute(ClickKeyword.groovy:43)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:73)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.click(WebUiBuiltInKeywords.groovy:616)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$click$2.call(Unknown Source)
at Script1596799305922.run(Script1596799305922.groovy:20)
… 13 more

It is working fine in normal chrome and chrome headless[ when running from KRE] but failing in gitlab.

I am wondering if its same issue as Cannot find elements when XPath expression is null

@duyluong

@anuradha

This seems to be a difference in the screen resolution of Gitlab’s browser and local browser, so the elements appearing in one case and not the other. I suggest you open another topic with the error log to gain more traction, since this topic has been about activating KRE, which doesn’t seem to be the issue here.

Thanks @ThanhTo, i was wondering if this has anything to do with the warning with chromedriver i got when the tests started running.
Also most of the time i have run tests with windowsize same as headless tests i use for kre and it worked okay on gitlab.
I have cloned my tests on another folder and then put it in a separate gitlab account. Can this be the issue?
Also i am using katalon-execute.sh can it also be the issue since it has deprecated?
If i use katalonc.sh it says project folder cannot be found even if i specify it in the script? I actually used the same format as logged in the forum. Do you think its because the project folder is different
Sorry i am just out of ideas wondering why what is working for everyone is not working for me
Thanks

This is the exact issue i am facing when running my test with katalonc.sh

Not sure if it worked after the fix though.
@ThanhTo

Also now i have added the full yml file in case something wrong with it:

image: katalonstudio/katalon
services:

  • docker:dind

before_script:

  • apt-get update >/dev/null
  • apt-get install -y locales >/dev/null
  • echo “en_US UTF-8” > /etc/locale.gen
  • locale-gen en_US.UTF-8
  • export LANG=en_US.UTF-8
  • export LANGUAGE=en_US:en
  • export LC_ALL=en_US.UTF-8

stages:

  • test

test_job:
stage: test
script:
image: katalonstudio/katalon

stages:

  • test

test_job:
stage: test

script:
- katalonc.sh -projectPath="/home/anuradha/Desktop/project.prj" -retry=0 -executionProfile= “xxxx” -apiKey=“xxxxxxx” -testSuitePath=“xxxxx”

artifacts:
name: “$CI_COMMIT_REF_NAME”
paths:
- report/
reports:
junit:
- ‘report/*.xml’

I am getting the issue with selector when using katalon-execute.sh and with katalon.sh i cannot find the project at all.

I think katalonc.sh is not recognizing the path because you haven’t mounted the project path to Docker yet. Please refer to

You can see the example command in:

Unfortunately I am not well-versed in this domain.

Hi @ThanhTo, I am using linux and have added the run_chrome.sh file with the content below:
`docker run -t --rm -v “$(pwd)”:/katalon/katalon/source katalonstudio/katalon 7.5 katalonc.sh -projectPath="/katalon/katalon/source/project.prj" -browserType=“Chrome (headless)” -retry=0 -testSuitePath=“Test Suites/Generic_Test_Cases/xxxx” -apiKey=“xxxxxxxx” - I am not sure if this file is working or not as i dont find any changes in my issue.

I have checked the below and i cannot find the gitlab-ci.yml file

If i will run the test in gitlab shouldn’t i be having a gitlab-ci.yml. I have like nothing as knowledge with docker

Also i still dont know why my machine quota is getting exceeded everytime

Is there someone who can help me with this. Kind of stuck with it from some time. :tired_face: