当我想运行iOS的UI测试时,我收到以下消息:
SetUp : System.Exception : Unable to determine simulator version for X
堆栈跟踪:
at Xamarin.UITest.iOS.Instruments.GetMajorVersionForSimulator (System.String deviceIdentifier) [0x0008c] in <2a16c16730a54859bda72c6bc1c728f7>:0
at Xamarin.UITest.iOS.iOSAppLauncher.LaunchAppLocal (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration, Xamarin.UITest.Shared.Http.HttpClient httpClient, System.Boolean clearAppData) [0x0011a] in <2a16c16730a54859bda72c6bc1c728f7>:0
at Xamarin.UITest.iOS.iOSAppLauncher.LaunchApp (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration, Xamarin.UITest.Shared.Http.HttpClient httpClient, Xamarin.UITest.TestCloud.TestCloudiOSAppConfiguration testCloudAppConfiguration, Xamarin.UITest.Shared.Http.HttpClient testCloudWsClient, Xamarin.UITest.Shared.Http.HttpClient xtcServicesClient, System.Boolean testCloudUseDeviceAgent) [0x00068] in <2a16c16730a54859bda72c6bc1c728f7>:0
at Xamarin.UITest.iOS.iOSApp..ctor (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration, Xamarin.UITest.Shared.Execution.IExecutor executor) [0x002af] in <2a16c16730a54859bda72c6bc1c728f7>:0
at Xamarin.UITest.iOS.iOSApp..ctor (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration) [0x00000] in <2a16c16730a54859bda72c6bc1c728f7>:0
at Xamarin.UITest.Configuration.iOSAppConfigurator.StartApp (Xamarin.UITest.Configuration.AppDataMode appDataMode) [0x00017] in <2a16c16730a54859bda72c6bc1c728f7>:0
at UniversalApp.UITests.AppInitializer.StartApp (Xamarin.UITest.Platform platform) [0x0002d] in /Users/testing/backend/src/UniversalApp.UITests/AppInitializer.cs:33
at UniversalApp.UITests.DummyTests.BeforeEachTest () [0x00001] in /Users/testing/backend/src/UniversalApp.UITests/DummyTests.cs:26
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0003b] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.Reflection/MonoMethod.cs:305
当我在Android上运行相同的测试时,一切都像魅力一样。当我从xcode 10.2降级到10.1时发生这种情况,所以可能有些东西在那里被打破了。但奇怪的是,我可以毫无问题地调试我的iOS应用程序。
提前致谢
造成这个问题的原因是Xcode 10.2改变了Xamarin.UITest如何与本地iOS模拟器连接;在恢复兼容性之前需要更新Xamarin.UITest。根据我在复制问题时的观察结果,即使你降级到Xcode 10.1,iOS模拟器似乎也保留了Xcode 10.2应用的一些设置,因此继续阻止测试。
目前还没有支持Xcode 10.2的Xamarin.UITest版本,但我怀疑它将在下一个版本中发布。 (撰写本文时的最新版本是2.2.7.28-dev)
以前在其他Xcode更新中也发生过这种情况: