我在共享应用程序的 iOS 端运行 Xamarin UItests 时遇到了一些问题。测试在 Android 上运行没有问题,但是
System.Exception
当我尝试在 iOS 上运行它们时,我得到了一个。
设置:System.Exception:此应用程序包不适用于在模拟器上运行。要解决此问题,请确保您的目标设备是模拟器。要针对物理设备上已安装的应用程序运行,您可以使用 InstalledApp("ie.eoin.myapp")
我尝试在模拟器上以及在具有相同异常的真实设备上运行测试。下面是堆栈跟踪的开始。
Xamarin.UITest.iOS.iOSAppLauncher.LaunchAppLocal(Xamarin.UITest.Configurati`enter code here`on.IiOSAppConfiguration appConfiguration, Xamarin.UITest.Shared.Http.HttpClient httpClient, System.Boolean clearAppData) [0x0008a] in <b034e37336b84a95a2482a0c5f0be621>: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) [0x0007a] in <b034e37336b84a95a2482a0c5f0be621>:0
at Xamarin.UITest.iOS.iOSApp..ctor (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration) [0x00302] in <b034e37336b84a95a2482a0c5f0be621>:0
at Xamarin.UITest.Configuration.iOSAppConfigurator.StartApp (Xamarin.UITest.Configuration.AppDataMode appDataMode) [0x00017] in <b034e37336b84a95a2482a0c5f0be621>:0
at Shared.UITest.AppInitializer.StartApp () [0x00036] in /Users/eoinahern/Documents/xamarin_projs/HomeApp.Mobile/Shared/Shared.UITests/AppInitializer.cs:23
at Shared.UITest.Common.SetUp () [0x00002] in /Users/eoinahern/Documents/xamarin_projs/HomeApp.Mobile/Shared/Shared.UITests/Common.cs:17
at Shared.UITests.MapScreensTests.SetUp () [0x00002] in /Users/eoinahern/Documents/xamarin_projs/HomeApp.Mobile/Shared/Shared.UITests/MapScreens/MapScreensTests.cs:16
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) [0x00038] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/MonoMethod.cs:305
在我startApp()
在课堂上的方法中AppInitializer
,路径指向.app
bin 目录中的正确文件。
public static IApp StartApp()
{
switch (TestEnvironment.Platform)
{
case TestPlatform.Local:
#if __IOS__
platform = Platform.iOS;
return ConfigureApp
.iOS
.AppBundle(GetLocalIOSTestAppPath()) .StartApp(Xamarin.UITest.Configuration.AppDataMode.Clear) as IApp;
#endif
}
我不确定为什么测试不会运行。我尝试更改为实际设备。此外,该.app
文件的图标看起来像停车标志中的符号。不知道这意味着什么。接下来我会看看这意味着什么,但现在我很难过。任何帮助表示赞赏。严重卡在这里。