简体   繁体   English

如何在真实设备上安装 XCUITest runner 应用程序和 ipa 并获取结果?

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

How do I install the XCUITest runner app and ipa on a real device and get the results?如何在真实设备上安装 XCUITest runner 应用程序和 ipa 并获取结果?

I have a runner.app that was generated by building it for testing, and a deployed/signed.ipa.我有一个 runner.app 是通过构建它进行测试而生成的,还有一个 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.现在我想要发生的是将它安装在真实设备上,执行它并获取设备日志。

You can try to use:您可以尝试使用:

xcodebuild test-without-building -xctestrun somepath/YourAppName_iphoneos14.4-arm64.xctestrun -destination 'platform=iOS, id=some_id' 

I moved YourAppName_iphoneos14.4-arm64.xctestrun , YourAppName.app , YourAppNameUITests-Runner.app to some local folder from a regular Library/Developer/etc.. build folder.我将YourAppName_iphoneos14.4-arm64.xctestrunYourAppName.appYourAppNameUITests-Runner.app从常规Library/Developer/etc.. etc..build 文件夹移动到某个本地文件夹。 Then I opened *.xctestrun file, which is an xml file, and modified paths to my local folder manually.然后我打开*.xctestrun文件,这是一个xml文件,并手动修改本地文件夹的路径

I couldn't find any official information about it but it seems like the *.xctestrun file is used by xcodebuild in order to find all relevant artefacts ie both app folders.我找不到关于它的任何官方信息,但xcodebuild似乎使用*.xctestrun文件来查找所有相关的人工制品,即两个应用程序文件夹。 I would guess that's how they manage to run tests just with app's or ipa's without source code on various clouds...我猜想这就是他们如何设法在各种云上没有源代码的情况下仅使用应用程序或 ipa 运行测试......

PS.附言。 The question was about IPA , but it's convertible to the app, right?问题是关于IPA的,但它可以转换为应用程序,对吧? At least there is a thread - How to convert.ipa to.app file?至少有一个线程 - How to convert.ipa to.app file?

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: 为了构建UI测试应用程序捆绑包的ipa,您可以按照以下步骤操作:

  1. Open your project containing in Xcode. 打开包含在Xcode中的项目。
  2. Select the device you'd like to build the ipa for next to the scheme. 在方案旁边选择要为其构建ipa的设备。 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. 在派生数据中找到[your_ui_test_bundle_name] .app文件。

    • Derived data by default is located at ~/Library/Developer/Xcode/DerivedData/ 默认情况下,派生数据位于〜/ 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 要找到此文件,请进入您的项目的DerivedData,导航至Build > Products ,然后根据在步骤2中选择的内容进入相应的目录。如果选择了模拟器,请在-iphonesimulator /中查找, 或者在设备中选择 -iphoneos/ . -iphoneos / The UI test bundle .app file should be in that directory. UI测试包.app文件应位于该目录中。
  5. Create a directory named Payload case sensitive and it must be named this. 创建一个名为目录有效载荷大小写敏感的,它必须被命名此。

  6. Move the .app file into the Payload directory. .app文件移动到Payload目录中。
  7. Compress the Payload directory. 压缩有效负载目录。
  8. Rename the compressed directory to have a file extension of .ipa. 重命名压缩目录以具有.ipa文件扩展名。 You'll be prompted and select Keep .ipa . 系统将提示您,然后选择Keep .ipa

Now you have you UI test bundle application saved as an ipa. 现在,您已将UI测试包应用程序另存为ipa。 You can also upload this ipa to a device manually in Xcode via the following process (bonus info, yay!) 您还可以通过以下过程将此ipa手动上传到Xcode中的设备(奖励信息,是的!)。

  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. 导航到并选择您先前压缩的UI测试.ipa文件。
  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 信用到期日: https : //medium.com/ios-os-x-development/how-to-run-your-iphone-test-on-aws-device-farm-98f18086811e

您可以使用bundleId:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在模拟器或真机上安装ipa文件? - How to install ipa file on simulator or real device? 如何将设备上的移动应用程序转换为 IPA 文件? - How do I convert a mobile app on my device into an IPA file? 如何从Xcode获取ipa文件以在真实设备中运行iPhone应用程序? - How to get ipa file from Xcode to run an iPhone app in real device? 如何将IPA安装到IOS设备,不使用ITUNES,怎么办? - How to Install IPA to an IOS device, do not use ITUNES, How to do ? 我可以在真正的 iPhone 设备上安装 Codemajic 生成的文件 Runner.app.zip 吗? (Codemajic 搭建的 Flutter 项目) - Can I install on real iPhone device the file Runner.app.zip generated by Codemajic? (Flutter project built by Codemajic) 如何获取IPA文件并将其远程安装在iOS设备上? - How do I take an IPA file and have it install remotely on an iOS device? Flutter:尝试将 flutter 应用程序安装到真正的 iOS 设备时,无法安装“Runner”错误 - Flutter: unable to install "Runner" error when trying to install flutter app to real iOS device 有没有办法获得我在iOS设备上的App Store应用程序中获得的搜索结果? (如何获取“Ap​​p Store”的ipa文件?) - Is there a way to get the search result i get in the App Store app on the iOS device? ( How to get the ipa file of “App Store”? ) 如何在真实设备上运行/测试我的 Flutter 应用程序? - How do I run/test my Flutter app on a real device? 如何使用 Expo 在真实的 iOS 设备上运行应用程序? - How do I run an app on a real iOS device using Expo?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM