【发布时间】:2019-02-13 08:40:14
【问题描述】:
我正在尝试使用 Xamarin.UITest 测试我的 Xamarin.Forms 应用程序。 Android工作正常,但iOS部分有问题。在执行我的第一个测试以进入 REPL 时,我收到以下错误:
SetUp : System.Exception : Unable to contact test backend running in app. A common cause is that the app is not properly linked with Calabash. Please verify that it includes the Calabash component.
奇怪的是,当将应用上传到 Microsoft 应用中心时,它会开始测试。它只是挂起,因为它找不到我的工具栏项。我想通过在我的 Mac 上进行 iOS 测试来检查 REPL 的有效查询,而我通常在 Windows 上使用 Visual Studio。
我尝试了我在网上找到的解决方案,但没有成功
- 我的 .iOS 项目包括 Xamarin.TestCloud.Agent
- 在 AppDelegate.cs 中,我在 global::Xamarin.Forms.Forms.Init() 之后直接有 Xamarin.Calabash.Start()。
- 我在 UITest 项目中有 NUnit 2.6.4 和 NUnitTestAdapter 2.1.1
- 我正在使用我的 Debug/IPhoneSimulator 配置
我正在从连接到 Mac 的 Windows 上的 Visual Studio 编译 .app 文件,并在 Mac 上启动 iOS 测试。
这是我当前的 AppInitializer 代码:
return ConfigureApp.iOS.AppBundle(sPathToiOS).PreferIdeSettings().StartApp();
有时我也会收到不同的错误:
SetUp : Xamarin.UITest.XDB.Exceptions.DeviceAgentException : Unable to contact DeviceAgent
----> System.AggregateException : One or more errors occurred.
----> Xamarin.UITest.XDB.Exceptions.DeviceAgentException : Unable to contact DeviceAgent on 127.0.0.1
----> System.Net.Http.HttpRequestException : An error occurred while sending the request
----> System.Net.WebException : Error: ConnectFailure (Connection refused)
----> System.Net.Sockets.SocketException : Connection refused
这似乎是在启动测试时模拟器未运行并且启动模拟器需要很长时间时发生的。
【问题讨论】:
-
只需预先启动 iOS 模拟器并让它运行。
-
不幸的是,这无济于事。当我开始测试时,模拟器会重新启动。有没有可能,Mac 太慢了,无法及时启动一切?我可以毫无问题地在模拟器中从 Windows 启动我的应用程序,但使用 Mac 感觉就像看着油漆变干。
-
Is it possible, the Mac is just too slow to start everything in time...当然可能是这种情况....模拟器是磁盘 IO 猪(它喜欢 SSD 并且讨厌主轴驱动器,至少在启动速度方面),如果你的 mac 是内存有限,并且正在交换会杀死性能的页面。手动启动模拟器并进入跳板(主)屏幕需要多长时间? (Simulator.app(在已安装的 Xcode 包中)) -
从点击到看到主屏幕花了 1:25。在没有 teamviewer 的情况下直接在 Mac 上工作似乎对性能有好处(我花时间直接在 Mac 上工作),但我只进入过一次 REPL,不久之后它就崩溃了。这是一台 Mac mini 2014 i7,配备 8GB RAM 和无 SSD
-
取决于我使用 15/20 秒冷启动模拟器的 Mac 时间:-/ 但所有这些都是基于 SSD 的,我有一台 MacBook Pro是基于主轴的,2 分钟以上并不少见(在这种情况下 CPU/i7 和 RAM/16gb 不是问题,只是主轴驱动器速度)
标签: ios xamarin xamarin.forms visual-studio-mac xamarin.uitest