Unable to execute via Remote

Hi team,

I’m trying to execute Android tests with external appium server.

When I test via Android, it’s done successfully. The app is launched and tap events are dispatched.

However, when I test via Remote, The app is launched but soon it quits. I can’t understand these differences.

Can anyone help me with this?

My code and logs: GitHub - mlspinylobster/help-me-katalon-forum-10239: ~~For asking in Katalon Forum~~ Sample of testing an Android app via Katalon Studio by remote Appium server.

OS: macOS 10.12.6

Katalon Studio: 5.8.0

Appium: 1.8.1

In my code, I create MobileDriver manually in Test Listener because it doesn’t send any requests to my appium server when default.

I also want to resolve this. Why does Katalon ignore appium configs in Remote execution?

Thanks,

Satoshi

In your https://github.com/mlspinylobster/help-me-katalon-forum-10239, I found how you executed it:

$ wd=$(pwd)$ /Applications/Katalon\ Studio.app/Contents/MacOS/katalon --args -noSplash  -runMode=console -projectPath="${wd}/KatalonAndroidSample.prj" -retry=0 -testSuitePath="Test Suites/Sample Test" -remoteWebDriverType="Appium" -executionProfile="default" -remoteWebDriverUrl="http://localhost:4723/wd/hub" -browserType="Remote"

I have a doubt about this.

Katalon document ( https://docs.katalon.com/katalon-studio/docs/console-mode-execution.html#execute-katalon-in-cmd ) says:

Execute Katalon in CMD

1. Open the command prompt and navigate to the folder of your Katalon Studio build, which contains katalon.exe (Windows) or Applications folder (Mac OS) or katalon (Linux) file.

So I suppose you should rather do:

$ wd=$(pwd)$ cd /Applications/Katalon\ Studio.app/Contents/MacOS$ katalon --args -noSplash  -runMode=console -projectPath="${wd}/KatalonAndroidSample.prj" -retry=0 -testSuitePath="Test Suites/Sample Test" -remoteWebDriverType="Appium" -executionProfile="default" -remoteWebDriverUrl="http://localhost:4723/wd/hub" -browserType="Remote"

Thank you!

I do that command(almost same. but I just changed “katalon” -> “./katalon”) but the result was same.
I also tried “cd /Applications” according to the generated command by Katalon Studio, but the result was same, too.

Anyway, thank you for your reply!

Could you show us the .log file?I expect some StackTrace is there, which will tell us the root cause.

.log file should be found at \config\.metadata\.log on Mac

Here: https://gist.githubusercontent.com/mlspinylobster/c692747cc963cf0a96db148f0fe40331/raw/24d3603db4b84ff535963361bc5584a23477584b/.log

And, in the GitHub repository, I already added log files.
When I execute tests via Remote: https://github.com/mlspinylobster/help-me-katalon-forum-10239/tree/f4d69967f80e1227415aedcb70790c53346541fc/Reports/Sample%20Test/20181015_174454

Could you execute this Remote test successfully? Is it some environment problem?

$ ./katalon --args

Where does --args come from?
I have never seen --args in the document.

I found nothing informative in .log

Then why not adding -consoleLog and --noExit option so that it opens another window in which you will see runtime log information.

$ ./katalon -consoleLog -noExit -noSplash  -runMode=console -projectPath="${wd}/KatalonAndroidSample.prj" 

I removed `–args

Please note you should not give -consoleLog and --noExit when running it under Jenkins.`

In https://github.com/mlspinylobster/help-me-katalon-forum-10239/blob/master/Reports/Sample%20Test/20181015_174454/JSON_Report.json, I found an interesting message.

{"devicePlatform":"", "logFolder":"/Users/satoshiisemura/dev/katalon/KatalonAndroidSample/Reports/Sample Test/20181015_174454","runData":{    "hostName":"satoshiisemura - 192.168.10.3","os":"Mac OS X 64bit",    "katalonVersion":"5.8.0.1","deviceOS":"null",    "appiumVersion":"1.8.1","deviceModel":"null",    "hostAddress":"192.168.10.3","deviceManufacturer":"null",    "deviceId":"null",    "deviceName":"null",    "deviceOSVersion":"null"},"type":"TEST_SUITE","name":"Sample Test","id":"Test Suites/Sample Test","source":"","message":"Test Cases/Sample FAILED because (of) (Stack trace: com.kms.katalon.core.exception.StepFailedException: Unable to start app at: \u0027/Users/satoshiisemura/dev/katalon/KatalonAndroidSample/androidapp/Sample.apk\u0027 (Root cause: java.lang.IllegalArgumentException:     The mobile device is missing.     Please select the mobile device to be executed and try again.)\n\tat 

I am not sure what this message means, but I wonder if your Appium Server at http://localhost:4723/wd/hub has a real Adroid device attached? It seems not.

@kazurayam Very thanks!

I added several changes to my sample repository.

  • sample app now compiled for android SDK 14-28
  • changed steps to reproduce the problem in line with official document (little changes)
  • update execution logs

@kazurayam

I use macOS.

Mac OS:
./Katalon\ Studio.app/Contents/MacOS/katalon --args {option1} {option2} … {optionN}

This is written in the document.
And my command was generated from Katalon Studio Build CMD feature so I don’t think the command has some problems.
If you use other OS, please change it to suit your OS.


Now we can see what runtime exception was thrown by Katalon. -> console.log.
Is this the information you want?


This error message is completely wrong.
When I execute Remote test, the app is installed to my device and the app launch.
However, it exits soon because Katalon test fails by the exception.
Could you try to execute my test?

Please see these two appium logs:

From a standpoint of Appium, there are no meaningful differences until these lines.
Why can’t I execute Remote test successfully? Should I report this as an issue of Katalon Studio?

This is the root cause:

12-05-2018 07:43:19 午後 - [FAILED] - Test Cases/Sample FAILED because (of) (Stack trace: com.kms.katalon.core.exception.StepFailedException: Unable to start app at: '/Users/satoshiisemura/dev/katalon/KatalonAndroidSample/androidapp/Sample.apk' (Root cause: java.lang.IllegalArgumentException: The mobile device is missing. Please select the mobile device to be executed and try again.)
        at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:36)
        at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.stepFailed(MobileKeywordMain.groovy:40)
        at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:23)
        at com.kms.katalon.core.mobile.keyword.builtin.StartApplicationKeyword.startApplication(StartApplicationKeyword.groovy:51)
        at com.kms.katalon.core.mobile.keyword.builtin.StartApplicationKeyword.execute(StartApplicationKeyword.groovy:40)
        at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:53)
        at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords.startApplication(MobileBuiltInKeywords.groovy:74)
        at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords$startApplication.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
        at Script1538637878312.run(Script1538637878312.groovy:20)
        at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:183)
        at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:108)
        at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:294)
        at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:285)
        at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:264)
        at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:256)
        at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:200)
        at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:129)
        at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:112)
        at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:81)
        at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:142)
        at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:141)
        at TempTestSuite1544006582239.run(TempTestSuite1544006582239.groovy:36)
        at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:263)
        at groovy.lang.GroovyShell.run(GroovyShell.java:518)
        at groovy.lang.GroovyShell.run(GroovyShell.java:507)
        at groovy.ui.GroovyMain.processOnce(GroovyMain.java:653)
        at groovy.ui.GroovyMain.run(GroovyMain.java:384)
        at groovy.ui.GroovyMain.process(GroovyMain.java:370)
        at groovy.ui.GroovyMain.processArgs(GroovyMain.java:129)
        at groovy.ui.GroovyMain.main(GroovyMain.java:109)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
        at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)
)

Start Application keyword requires you to select a mobile device from Katalon interface. If you want to execute through remote execution,:

  • Add app desired capabilities and point to your application.
  • Use this and uncomment Start Application step.
AppiumDriverManager.createMobileDriver(MobileDriverType.ANDROID_DRIVER, capabilities, new URL(serverUrl))
//Mobile.startApplication(pathToApplicationFile, false) 

Thanks! I finally got passed the test by your advice.