XUnit Runner for Xamarin Devices IOS 在 Jenkins 上通过命令行安装应用程序

XUnit Runner for Xamarin Devices IOS install App via Command Line on Jenkins

作为 CI 构建过程的一部分,我想构建,然后在构建服务器上 运行 一个 IOS XUnit Runner (https://github.com/xunit/devices.xunit),最后监控其结果。

构建应用程序后,我必须在此处尝试在模拟器上加载应用程序 -

/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch --sdkroot /Applications/Xcode.app -launchsim Users/me/Dev/mydir/xunit.app --device=iphone

让我明白

error MT1212: Failed to create a simulator where type = iPhone 4s (com.apple.CoreSimulator.SimDeviceType.iPhone-4s) and runtime = iOS 11.2 (11.2 - 15C107) - com.apple.CoreSimulator.SimRuntime.iOS-11-2.

将 --device 更改为 ipad 会出现与 iPad 相关的类似错误。

我可以用

仪器-w 帮助

给我一份这些模拟人生的列表(缩短)-

iMac 2017 [CCC8A9DA-BB70-58B4-9653-39EEE0789847] iPhone (11.2.6) [28061ef6effc9e9e12a8f5932d5e07c219340f3e] iPhone X (11.2) [77911DFD-7E53-4CAD-AEE3-A119EC22D14E] (Simulator)

但我不知道如何从该列表的命令行启动和加载应用程序到 SPECIFIC 模拟器。

另外,当 Xamarin 启动调试等时,我是否可以看到 Xamarin 调用以在设备上启动和安装应用程序的命令行?

我们使用 -

进一步调查后解决了这个问题
xcrun simctl

及其在 IOS 模拟器上控制和安装应用程序的各种选项。

如果您从 instruments -w help 或 xcrun simctl list call

复制 GUID

[28061ef6effc9e9e12a8f5932d5e07c219340f3e] iPhone X (11.2) [77911DFD-7E53-4CAD-AEE3-A119EC22D14E](模拟器)

您可以使用 -

等调用

关闭 Sim

xcrun simctl shutdown 28061ef6effc9e9e12a8f5932d5e07c219340f3e

启动模拟

xcrun simctl boot 28061ef6effc9e9e12a8f5932d5e07c219340f3e

一旦你启动了一个sim卡,你就不需要再使用GUID了,你可以使用shorthand "booted"标识符-

擦除 Sim

xcrun simctl erase booted

安装应用程序

xcrun simctl install booted path/to/your.app

xcrun simctl launch --stderr=/somepath/err.txt booted path/to/your/appbundle.id

启动已安装的

 xcrun simctl launch --stderr=/users/matthewwaring/xunit.txt  79503DCD-A914-4128-BDD9-E68C867F5AA9 com.biid.sdk.core.xamarin.binding.ios.xunit

以此类推

我们已将这些调用集成到 Jenkins 脚本中并且一切正常。