Xamarin 无法在 Windows 的 mac 代理上远程启动:“Windows 不支持 iOS 测试";

问题描述:

我正在使用 Visual Studio 2015、C#、Xamarin 6.1.3.、iOS 10.2、iPhone 6s Plus、Xcode 8.2 编写移动自动测试.并尝试从 Mac Agent (OS X El Capitan 10.11.6) 上的 Windows 10 远程启动自动测试.我已经在 VS 中设置了远程连接,因此连接了 xamarin Mac Agent:这就是我尝试在我的代码中启动应用程序的方式:

I'm writing mobile autotests in Visual Studio 2015, C#, Xamarin 6.1.3., iOS 10.2, iPhone 6s Plus, Xcode 8.2. And trying to launch autotests remotely from windows 10 on Mac Agent (OS X El Capitan 10.11.6). I've setup remote connection in VS, so xamarin Mac Agent is connected: This is how i'm trying to launch application in my code:

IApp iApp = ConfigureApp
                .iOS
                .DeviceIp(mac_ip)
                .DeviceIdentifier(iphone_device_identifier)
                .AppBundle(/path_to_ipa/application.ipa)
                .Debug()
                .StartApp();

StartApp() 方法的测试失败并显示消息Windows 不支持 iOS 测试.":

Test fails on the StartApp() method with message "iOS tests are not supported on Windows.":

at Xamarin.UITest.iOS.iOSApp..ctor(IiOSAppConfiguration appConfiguration)
at Xamarin.UITest.Configuration.iOSAppConfigurator.StartApp(AppDataMode appDataMode)
at Xamarin.Application.Initialize() in D:\_framework mobile\framework\Framework\Xamarin\Application.cs:line 30
at Xamarin.Application..ctor() in D:\_framework mobile\framework\Framework\Xamarin\Application.cs:line 22
at Xamarin.Application.GetInstance() in D:\_framework mobile\framework\Framework\Xamarin\Application.cs:line 54
at Specflow.Hooks.BaseSteps.StartApplication() in D:\_framework mobile\framework\Framework\Specflow.Hooks\BaseSteps.cs:line 19
at lambda_method(Closure , IContextManager )
at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType bindingEvent)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnScenarioStart(ScenarioInfo scenarioInfo)
at TechTalk.SpecFlow.TestRunner.OnScenarioStart(ScenarioInfo scenarioInfo)
at Specflow.Features.DemoFeatureFeature.ScenarioSetup(ScenarioInfo scenarioInfo)
at Specflow.Features.DemoFeatureFeature.AddTwoNumbers() in D:\_framework mobile\framework\Framework\Specflow.Features\DemoFeature.feature:line 7
Result Message: 
Test method Specflow.Features.DemoFeatureFeature.AddTwoNumbers threw exception: 
System.Exception: iOS tests are not supported on Windows.

之前我在同一台设备和 mac 上使用 appium 启动了同一个应用程序 - 一切正常.

Earlier i've launched the same application using appium on the same device and mac - everything was OK.

我没有指定 .DevicePort() 因为我不知道如何获取端口,但我想当只有 1 个设备连接时没有必要.

I haven't specified .DevicePort() because i don't know how to get the port, but i guess it's not neccessary when only 1 device is connected.

我也尝试在模拟器中启动,但我遇到了同样的错误.

Also I've tried to launch in simulator, but i've got the same error.

不支持使用 Mac 代理从 Windows 运行 iOS Xamarin.UITests.来源:https://forums.xamarin.com/discussion/71138/how-to-run-test-using-vs-on-ios-simulator-on-mac#latest

Running iOS Xamarin.UITests from Windows using the Mac Agent is not supported. Source: https://forums.xamarin.com/discussion/71138/how-to-run-test-using-vs-on-ios-simulator-on-mac#latest