Problem with running 'sample test' in iOS

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