首页 > 解决方案 > 尝试在本地运行 Xamarin UITest 时“无法联系在应用程序中运行的测试后端”

问题描述

我正处于学习如何为我的公司自动化 Xamarin 应用程序的早期过程中。我一开始只是从 Microsoft 克隆TailWind Traders应用程序,以确保我的系统配置正确,但我遇到了问题。修改AppManager.cs为使用 .app 文件并尝试运行单个 iOS 测试后,我看到模拟器中的应用程序加载,我收到一条 Mac 警报,提示“您是否希望应用程序 'DeviceAgent-Runner.app' 接受传入的网络传输",然后测试失败并显示以下消息:

System.Exception : Unable to contact test backend running in app. Check that your app is running and that it is properly configured:

For Xamain.iOS applications,  https://docs.microsoft.com/en-us/appcenter/test-cloud/preparing-for-upload/xamarin-ios-uitest

For native iOS applications,  https://github.com/calabash/calabash-ios/wiki/Tutorial%3A-How-to-add-Calabash-to-Xcode

去那个网站,我看到它正在帮助用户配置运行测试 AppCenter,但我不想这样做。我只是想在我的机器上本地运行一个测试。为了解决这个问题,我卸载了 Xamarin 测试云代理包并#if ENABLE_TEST_CLOUDAppDelegate.cs. 但是,它仍在发生。如何在本地运行 iOS 测试?谢谢!

标签: xamarinxamarin.iosxamarin.uitest

解决方案


如果您想使用 xamarin 自动化 uitest,则必须在您的 xamarin ios 项目中添加测试云代理 nuget,以启用链接到 Calabash 并在您的手机中安装设备代理运行程序。有关更多详细信息,请访问 Microsoft 网站。 https://docs.microsoft.com/en-us/appcenter/test-cloud/uitest/preparing-for-upload-ios

无论您是在应用程序输入上上传测试还是在本地运行它。您必须在 xamarin ios 中添加测试云代理 nuget。如果您使用的是原生 iOS,Calabash 链接需要运行 xamarin uitest。


推荐阅读