How do I install the XCUITest runner app and ipa on a real device and get the results?

醉酒当歌 提交于 2019-12-13 12:14:21

问题


How do I install the XCUITest runner app and ipa on a real device and get the results?

I have a runner.app that was generated by building it for testing, and a deployed/signed .ipa.

Now what I would like to happen is to have it installed on a real device, execute it, and get the device log.


回答1:


Edited with answer...

It is possible to achieve this. In order to build an ipa of the UI Testing app bundle you can follow these steps:

  1. Open your project containing in Xcode.
  2. Select the device you'd like to build the ipa for next to the scheme. This can be an actual device or a simulator.
  3. Product > Build For > Testing
  4. Find [your_ui_test_bundle_name].app file in Derived Data.

    • Derived data by default is located at ~/Library/Developer/Xcode/DerivedData/
    • To locate this file, dive into DerivedData for your project, navigating to Build > Products and then the respective directory based on what you chose in step 2. If you chose a simulator, look in -iphonesimulator/ or if you chose a device look in -iphoneos/. The UI test bundle .app file should be in that directory.
  5. Create a directory named Payload case sensitive and it must be named this.

  6. Move the .app file into the Payload directory.
  7. Compress the Payload directory.
  8. Rename the compressed directory to have a file extension of .ipa. You'll be prompted and select Keep .ipa.

Now you have you UI test bundle application saved as an ipa. You can also upload this ipa to a device manually in Xcode via the following process (bonus info, yay!)

  1. Window > Devices and Simulators
  2. Select your connected device.
  3. Tap the + button under Installed Apps.
  4. Navigate to and select your UI test .ipa file that you compressed previously.
  5. It should install onto the device.

Credit where it is due: https://medium.com/ios-os-x-development/how-to-run-your-iphone-test-on-aws-device-farm-98f18086811e




回答2:


You can use bundleId :

let app = XCUIApplication(bundleIdentifier: "yourapp.bundle.id")


来源:https://stackoverflow.com/questions/47801985/how-do-i-install-the-xcuitest-runner-app-and-ipa-on-a-real-device-and-get-the-re

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!