Problem with running 'sample test' in iOS

When I try to run the test in iOS, the Katalon tries to open the coffee app a few times but it’s closing again. I followed all of your instruction and forums and tutorials but still I could not run it

xCode version is 9.4
katalon version is 5.9.0
appium version is 1.8.1
carthage version is 0.31.2
simulator with iOS 11.0.1

the Log Viewer stop in this line:
Appium server started on port 63,291

Also this is the Console message
***//////-------------------------------------------------------

SLF4J: The requested version 1.7.16 by your slf4j binding is not compatible with [1.6]

SLF4J: See SLF4J Error Codes for further details.

2018-11-29 12:00:33.949 INFO c.k.katalon.core.main.TestCaseExecutor - --------------------

2018-11-29 12:00:33.951 INFO c.k.katalon.core.main.TestCaseExecutor - START Test Cases/Mexican Coffee Timer

2018-11-29 12:00:35.008 DEBUG testcase.Mexican Coffee Timer - 1: startApplication(app_path, true)

2018-11-29 12:00:35.716 INFO c.k.k.c.a.driver.AppiumDriverManager - ios_webkit_debug_proxy server started on port 56848

2018-11-29 12:00:38.897 INFO c.k.k.c.a.driver.AppiumDriverManager - Appium server started on port 56,850

[Appium] Welcome to Appium v1.8.1

[Appium] Non-default server args:

[Appium] port: 56850

[Appium] chromeDriverPort: 56851

[Appium] tmpDir: /var/folders/7g/21lzx8w51_n1wh47vz05l_zr0000gp/T//Katalon/Appium/Temp1543489235719

[Appium] webkitDebugProxyPort: 56848

[Appium] Appium REST http interface listener started on 0.0.0.0:56850

[HTTP] → GET /wd/hub/status

[HTTP] {}

[debug] [MJSONWP] Calling AppiumDriver.getStatus() with args:

[debug] [MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.8.1”,“revision”:null}}

[HTTP] ← GET /wd/hub/status 200 18 ms - 83

[HTTP]

[HTTP] → POST /wd/hub/session

[HTTP] {“desiredCapabilities”:{“app”:“/Users/cha/Desktop/Test katalon/Test Project.prj/App/Coffee Timer 2018-06-20 15-04-42/Coffee Timer.ipa”,“automationName”:“XCUITest”,“deviceName”:“iPad Air 2”,“fullReset”:true,“newCommandTimeout”:1800,“noReset”:false,“platform”:“IOS”,“platformName”:“iOS”,“platformVersion”:“11.0”,“realDeviceLogger”:“/Applications/Katalon Studio.app/Contents/Eclipse/configuration/resources/tools/deviceconsole/deviceconsole”,“waitForAppScript”:“true;”,“wdaLocalPort”:56847},“capabilities”:{“desiredCapabilities”:{“app”:“/Users/cha/Desktop/Test katalon/Test Project.prj/App/Coffee Timer 2018-06-20 15-04-42/Coffee Timer.ipa”,“automationName”:“XCUITest”,“deviceName”:“iPad Air 2”,“fullReset”:true,“newCommandTimeout”:1800,“noReset”:false,“platform”:“IOS”,“platformName”:“iOS”,“platformVersion”:“11.0”,“realDeviceLogger”:“/Applications/Katalon Studio.app/Contents/Eclipse/configuration/resources/tools/deviceconsole/deviceconsole”,“waitForAppScript”:“true;”,“wdaLocalPort”:56847},"firstMat

[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{“app”:“/Users/cha/Desktop/Test katalon/Test Project.prj/App/Coffee Timer 2018-06-20 15-04-42/Coffee Timer.ipa”,“automationName”:“XCUITest”,“deviceName”:“iPad Air 2”,“fullReset”:true,“newCommandTimeout”:1800,“noReset”:false,“platform”:“IOS”,“platformName”:“iOS”,“platformVersion”:“11.0”,“realDeviceLogger”:“/Applications/Katalon Studio.app/Contents/Eclipse/configuration/resources/tools/deviceconsole/deviceconsole”,“waitForAppScript”:“true;”,“wdaLocalPort”:56847},null,{“desiredCapabilities”:{“app”:“/Users/cha/Desktop/Test katalon/Test Project.prj/App/Coffee Timer 2018-06-20 15-04-42/Coffee Timer.ipa”,“automationName”:“XCUITest”,“deviceName”:“iPad Air 2”,“fullReset”:true,“newCommandTimeout”:1800,“noReset”:false,“platform”:“IOS”,“platformName”:“iOS”,“platformVersion”:“11.0”,“realDeviceLogger”:“/Applications/Katalon Studio.app/Contents/Eclipse/configuration/resources/tools/deviceconsole/deviceconsole”,“waitForAppScript”:“true;”,“wdaLocalPort”:56847},“firstMatch”:[{“platformName”:“ios”}]}]

[debug] [BaseDriver] Event ‘newSessionRequested’ logged at 1543489239539 (12:00:39 GMT+0100 (Central European Standard Time))

[Appium] Could not parse W3C capabilities: ‘deviceName’ can’t be blank. Falling back to JSONWP protocol.

[Appium] The following capabilities were provided in the JSONWP desired capabilities that are missing in W3C capabilities: [“app”,“automationName”,“deviceName”,“fullReset”,“newCommandTimeout”,“noReset”,“platform”,“platformName”,“platformVersion”,“realDeviceLogger”,“waitForAppScript”,“wdaLocalPort”]. Falling back to JSONWP protocol.

[Appium] Creating new XCUITestDriver (v2.84.0) session

[Appium] Capabilities:

[Appium] app: /Users/cha/Desktop/Test katalon/Test Project.prj/App/Coffee Timer 2018-06-20 15-04-42/Coffee Timer.ipa

[Appium] automationName: XCUITest

[Appium] deviceName: iPad Air 2

[Appium] fullReset: true

[Appium] newCommandTimeout: 1800

[Appium] noReset: false

[Appium] platform: IOS

[Appium] platformName: iOS

[Appium] platformVersion: 11.0

[Appium] realDeviceLogger: /Applications/Katalon Studio.app/Contents/Eclipse/configuration/resources/tools/deviceconsole/deviceconsole

[Appium] waitForAppScript: true;

[Appium] wdaLocalPort: 56847

[debug] [BaseDriver] Creating session with MJSONWP desired capabilities: {“app”:"/Users/cha/Desktop/…

[BaseDriver] The following capabilities were provided, but are not recognized by appium: platform.

[BaseDriver] Session created with session id: f21adda6-57a6-465d-bb2c-fa0c0c6f2bfd

[debug] [XCUITest] Current user: ‘cha’

[debug] [XCUITest] Xcode version set to ‘9.4’ (tools v10.1.0.0.1.1539992718)

[debug] [XCUITest] iOS SDK Version set to ‘11.4’

[debug] [BaseDriver] Event ‘xcodeDetailsRetrieved’ logged at 1543489239740 (12:00:39 GMT+0100 (Central European Standard Time))

[iOSSim] Constructing iOS simulator for Xcode version 9.4 with udid ‘F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7’

[XCUITest] Determining device to run tests on: udid: ‘F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7’, real device: false

[BaseDriver] Using local app ‘/Users/cha/Desktop/Test katalon/Test Project.prj/App/Coffee Timer 2018-06-20 15-04-42/Coffee Timer.ipa’

[debug] [BaseDriver] Copying local zip to tmp dir

[BaseDriver] Unzipping local app ‘/var/folders/7g/21lzx8w51_n1wh47vz05l_zr0000gp/T/20181029-24155-ygn8wr.w898s/appium-app.zip’…

[debug] [BaseDriver] Unzipping /var/folders/7g/21lzx8w51_n1wh47vz05l_zr0000gp/T/20181029-24155-ygn8wr.w898s/appium-app.zip

[debug] [BaseDriver] Testing zip archive: /var/folders/7g/21lzx8w51_n1wh47vz05l_zr0000gp/T/20181029-24155-ygn8wr.w898s/appium-app.zip

[BaseDriver] Unzipped local app to ‘/var/folders/7g/21lzx8w51_n1wh47vz05l_zr0000gp/T/20181029-24155-ygn8wr.w898s/Payload/Coffee Timer.app’

[debug] [BaseDriver] Event ‘appConfigured’ logged at 1543489240113 (12:00:40 GMT+0100 (Central European Standard Time))

[debug] [XCUITest] Checking whether app ‘/var/folders/7g/21lzx8w51_n1wh47vz05l_zr0000gp/T/20181029-24155-ygn8wr.w898s/Payload/Coffee Timer.app’ is actually present on file system

[debug] [XCUITest] App is present

[debug] [iOS] Getting bundle ID from app ‘/var/folders/7g/21lzx8w51_n1wh47vz05l_zr0000gp/T/20181029-24155-ygn8wr.w898s/Payload/Coffee Timer.app’: ‘com.ashfurrow.Coffee-Timer-2’

[debug] [BaseDriver] Event ‘resetStarted’ logged at 1543489240117 (12:00:40 GMT+0100 (Central European Standard Time))

[debug] [XCUITest] Reset: fullReset is on. Cleaning simulator

[debug] [XCUITest] Killing running processes ‘xcodebuild.*F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7, F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7.*XCTRunner’ for the device F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7…

[debug] [XCUITest] ‘pgrep -nif xcodebuild.*F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7’ didn’t detect any matching processes. Return code: 1

[debug] [XCUITest] ‘pgrep -nif F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7.*XCTRunner’ didn’t detect any matching processes. Return code: 1

[iOSSim] Cleaning simulator F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7

[debug] [BaseDriver] Event ‘resetComplete’ logged at 1543489246006 (12:00:46 GMT+0100 (Central European Standard Time))

[XCUITest] Continuing without capturing device logs: iOS Simulator with udid F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7 is not running

[XCUITest] Setting up simulator

[debug] [iOS] No reason to set locale

[debug] [iOS] No iOS / app preferences to set

[debug] [iOSSim] No Simulator cache items for cleanup were matched in ‘/Users/cha/Library/Developer/CoreSimulator/Devices/F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7/data/Library/Caches’

[debug] [iOSSim] Setting preferences of F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7 Simulator to {“ConnectHardwareKeyboard”:false}

[debug] [iOSSim] Setting common Simulator preferences to {“ConnectHardwareKeyboard”:false}

[debug] [iOSSim] Updated F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7 Simulator preferences at ‘/Users/cha/Library/Preferences/com.apple.iphonesimulator.plist’ with {“DevicePreferences”:{“F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7”:{“ConnectHardwareKeyboard”:false}},“ConnectHardwareKeyboard”:false}

[debug] [iOSSim] The count of running Simulator UI client instances is 1

[iOSSim] Booting Simulator with UDID F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7…

[iOSSim] Simulator with UDID F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7 booted in 40 seconds

[debug] [BaseDriver] Event ‘simStarted’ logged at 1543489287105 (12:01:27 GMT+0100 (Central European Standard Time))

[debug] [XCUITest] Starting log capture for iOS Simulator with udid ‘F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7’, using ‘xcrun simctl spawn F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7 log stream --style compact’

[debug] [BaseDriver] Event ‘logCaptureStarted’ logged at 1543489288575 (12:01:28 GMT+0100 (Central European Standard Time))

[debug] [XCUITest] Verifying application platform

[debug] [XCUITest] CFBundleSupportedPlatforms: [“iPhoneOS”]

[XCUITest] *********************************

[XCUITest] Simulator architecture appears to be unsupported by the ‘/var/folders/7g/21lzx8w51_n1wh47vz05l_zr0000gp/T/20181029-24155-ygn8wr.w898s/Payload/Coffee Timer.app’ application. Make sure the correct deployment target has been selected for its compilation in Xcode.

[XCUITest] Don’t be surprised if the application fails to launch.

[XCUITest] *********************************

[debug] [XCUITest] Installing ‘/var/folders/7g/21lzx8w51_n1wh47vz05l_zr0000gp/T/20181029-24155-ygn8wr.w898s/Payload/Coffee Timer.app’ on Simulator with UUID ‘F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7’…

[debug] [XCUITest] The app has been installed successfully.

[debug] [BaseDriver] Event ‘appInstalled’ logged at 1543489293984 (12:01:33 GMT+0100 (Central European Standard Time))

[XCUITest] Using WDA path: ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent’

[XCUITest] Using WDA agent: ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj’

[debug] [XCUITest] No obsolete cached processes from previous WDA sessions listening on port 56847 have been found

[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:56847/status\] with no body

[debug] [XCUITest] WDA is not listening at ‘http://localhost:56847/

[debug] [BaseDriver] Event ‘wdaStartAttempted’ logged at 1543489294111 (12:01:34 GMT+0100 (Central European Standard Time))

[XCUITest] Launching WebDriverAgent on the device

[debug] [XCUITest] Carthage found: ‘/Applications/Katalon Studio.app/Contents/Eclipse/configuration/resources/tools/carthage/0.18.1/etc/bash_completion.d/carthage’

[debug] [XCUITest] Killing running processes ‘xcodebuild.*F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7, iproxy 56847, F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7.*XCTRunner’ for the device F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7…

[debug] [XCUITest] ‘pgrep -nif xcodebuild.*F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7’ didn’t detect any matching processes. Return code: 1

[debug] [XCUITest] ‘pgrep -nif iproxy 56847’ didn’t detect any matching processes. Return code: 1

[debug] [XCUITest] ‘pgrep -nif F1F3C42C-F14B-4BA1-85C7-51A1B679BFE7.*XCTRunner’ didn’t detect any matching processes. Return code: 1

[debug] [XCUITest] Using Xcode 9.4, so fixing WDA codebase

[debug] [XCUITest] Beginning test with command 'xcodebuild build-for-testing test-without-building -project /usr/local/lib/node_modules/appiu…

***//////-------------------------------------------------------

Hi Connor,

Thanks for sharing the output log - it’s very helpful when troubleshooting!

From your log, I see a part that is probably causing the issue:

[debug] [XCUITest] Verifying application platform
[debug] [XCUITest] CFBundleSupportedPlatforms: ["iPhoneOS"]
[XCUITest] *********************************
[XCUITest] Simulator architecture appears to be unsupported by the '/var/folders/7g/21lzx8w51_n1wh47vz05l_zr0000gp/T/20181029-24155-ygn8wr.w898s/Payload/Coffee Timer.app' application. Make sure the correct deployment target has been selected for its compilation in Xcode.
[XCUITest] Don't be surprised if the application fails to launch.

It looks like the app that comes with the sample test might have been built for an actual device instead of a simulator; .ipa files are signed app files and usually built for a real device architecture instead of a simulator’s architecture, so they’re not interchangeable.

One thing you could do to run the tests as-is would be to plug in a real device to your computer and choose that when running the tests.

However, the more useful thing to do so that you can test on lots of devices is to rebuild the app for the simulator.

In order to build it for testing the simulator you can do the following:

1. Open the Xcode project within the sample test project: App/Your-First-iOS-App/Coffee Timer/Coffee Timer.xcodeproj
2. Open your Xcode->Preferences menu
3. Click the “Locations” button
4. Next to “Derived Data”, choose “Relative” from the drop-down menu.
5. Enter (or confirm) that “DerivedData” is in the text box next to the drop-down. This will put any apps you build in Xcode into a DerviedData directory within the project, so it’s easier to find.
6. Close the Preferences window
7. At the top of the Xcode window, you’ll see “Coffee Timer” and possibly the name of an iOS Simulator, or “Generic iOS Device”.
8. Click the simulator and you’ll get a drop-down of different simulators to build/run on
9. Choose one of the simulators, e.g. iPad Pro (10.5 inch) or iPhone 8
10. Click the “run” button in the upper left (or hit CMD+R on your keyboard)
11. This should build the app specifically for running on a simulator
12. Once the app runs in the simulator and it works, you can quit Xcode and the simulator
13. Open Katalon Studio
14. Open the Sample Test Project that you were working on
15. Expand the Profiles section in the left-hand navigation pane
16. Double-click the “default” profile
17. In the main window, you’ll see a list of environment variables, specifically “app_path”
18. Double-click the “app_path” variable
19. Click the “value” entry
20. Enter the location of the app you just built, which will probably be something like:

/Users/cha/Desktop/Test katalon/Test Project.prj/App/Your-First-iOS-App/Coffee Timer/DerivedData/Coffee Timer/Build/Products/Debug-iphonesimulator/Coffee Timer.app

NOTE: This is different than the .ipa that you were using before - this is because .ipa files aren’t made to be run on simulators, only real devices.

21. Click the OK button
22. Save the file
23. Expand the Test Cases tree in the left-hand navigation
24. Double click the Mexican Coffee Timer test to open it
25. Click the little arrow NEXT TO the Run button in the upper right
26. You’ll see a list of available platforms to run the test
27. Choose “iOS”
28. You’ll be prompted with a list of iOS simulators
29. Choose one of the simulators, e.g. iPad Pro (10.5 inch) or iPhone 8
30. Click OK
31. The test should now open the iOS simulator and run through the steps

Now you can continue to run tests on different simulators - you don’t need to rebuild the iOS project each time.

Hope this helps,

Chris

5 Likes

Thank you very much, Chris Trevarthen
Your answer was really useful and I could run the test in the simulator.
wish you the best

I could run the test in iOS Simulator but I couldn’t run it in a real device.
of course, first I change the path to the .ipa file.
---------- ---------- ----------
this is my debug error:

12-04-2018 10:10:18 AM Test Cases/Mexican Coffee Timer

Elapsed time: 19.655s

Test Cases/Mexican Coffee Timer FAILED.

Reason:

com.kms.katalon.core.exception.StepFailedException: Unable to start app at: ‘/Users/cha/Desktop/Coffee/CoffeeTimer.ipa’ (Root cause: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not install app: ‘Command ‘ios-deploy --id 6b5e902d56886c861d6fb0cc4bc53afd973319cf --bundle ‘/var/folders/7g/21lzx8w51_n1wh47vz05l_zr0000gp/T/2018114-38209-ooz5y4.eyixl/Payload/Coffee Timer.app’’ exited with code 253’ (WARNING: The server did not provide any stacktrace information)

Command duration or timeout: 11.85 seconds

Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:07:36.161Z’

System info: host: ‘MacBook-Connor.local’, ip: ‘10.8.1.45’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.13.6’, java.version: ‘1.8.0_181’

Driver info: driver.version: IOSDriver)

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 Mexican Coffee Timer.run(Mexican Coffee Timer:22)

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:321)

at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:312)

at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:291)

at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:283)

at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:222)

at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:106)

at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:97)

at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)

at TempTestCase1543914613342.run(TempTestCase1543914613342.groovy:22)

Hi Connor,

I think you’re running into one of the more confusing points of iOS development, aside from architecture, and that is code signing and provisioning. These things make sure that the app you are trying to put on your device is made by an authorized/trusted developer, it does only the things that it says it will do, and it runs only where it is allowed to run.

In the case of the sample Coffee Timer .ipa file, it was pre-built and signed by the Katalon team to only run on their devices (unfortunately, that isn’t clear in any of their documentation). So, you can’t just run that .ipa on your own device. However, what you can do is build a new .app file (like you did before for the simulator) but target your own device.

To do that:

- Plug in your device to your computer via USB
- Make sure you accept all Trust prompts on the phone and computer
- Open the Coffee Timer xcodeproj
- In the Xcode lefthand navigation pane/file browser, click the left-most icon that looks like a folder
- Click the top “Coffee Timer” project icon
- In the main pane of Xcode, you should see a navigation pane for Project and Targets
- Click the Coffee Timer target
- Along the top of the main pane, you should see a button for “General” - click that
- In the main pane, you should now see a section for Signing
- You should make sure “Automatically manage signing” is checked
- In the Team dropdown, choose your name with the words “Personal Team” next to it
- Xcode should create a provisioning profile and certificate
- At the top left of the Xcode window, near the “play button”, you should see “Coffee Timer” > Some iOS Device
- Click the iOS Device to open the drop-down
- Choose your actual plugged-in device
- Click the “play button”
- This should build the Coffee Timer and install it on your actual device
- This will also put a new Coffee Timer.app file in your DerivedData directory. NOTE, it’s slightly different this time, with one of the directories named “iphoneos”: /Users/cha/Desktop/Test katalon/Test Project.prj/App/Your-First-iOS-App/Coffee Timer/DerivedData/Coffee Timer/Build/Products/Debug-iphoneos/Coffee Timer.app
- You can now switch out and use that .app file in your Katalon test to run tests on your real device.

Hope this helps,

Chris