Xamarin.forms 中的 UITests 发布失败 [英] UITests Post Failed in Xamarin.forms

查看:24
本文介绍了Xamarin.forms 中的 UITests 发布失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个新的 Xmarain.Forms 项目和一个新的 Xmarain.Forms UI 测试项目.我已经设法将新创建的 Android apk 构建并安装到我的模拟设备上.

I've created a fresh Xmarain.Forms project and a fresh Xmarain.Forms UI Tests project. I've managed to get the freshly created Android apk built and installed to my emulated device.

我的单元测试应用程序能够连接到已安装的 apk.当它尝试运行第一个测试时,我收到以下错误:

My Unit Tests application is able to connect to the installed apk. When it attempts to run the first test I get the following error though:

System.Net.WebException : POST Failed
   at Xamarin.UITest.Shared.Http.HttpClient.HandleHttpError(String method, HttpResponseMessage response, ExceptionPolicy exceptionPolicy)
   at Xamarin.UITest.Shared.Http.HttpClient.SendData(String endpoint, String method, HttpContent content, ExceptionPolicy exceptionPolicy, Nullable`1 timeOut)
   at Xamarin.UITest.Shared.Http.HttpClient.Post(String endpoint, String arguments, ExceptionPolicy exceptionPolicy, Nullable`1 timeOut)
   at Xamarin.UITest.Shared.Android.HttpApplicationStarter.Execute(String intentJson)
   at Xamarin.UITest.Shared.Android.LocalAndroidAppLifeCycle.LaunchApp(String appPackageName, ApkFile testServerApkFile, Int32 testServerPort)
   at Xamarin.UITest.Android.AndroidApp..ctor(IAndroidAppConfiguration appConfiguration, IExecutor executor)
   at Xamarin.UITest.Configuration.AndroidAppConfigurator.StartApp(AppDataMode appDataMode)
   at New.Mobile.Tests.AppTests.BeforeEachTest()

我的 AndroidManifest.xml 非常基础:

My AndroidManifest.xml is pretty basic:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.New.Mobile" android:installLocation="internalOnly">
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="28" />
<application android:label="New.Mobile.Android" 
<uses-permission android:name="android.permission.INTERNET" />
</manifest>

我的应用程序中甚至没有任何 http 调用.是什么赋予了?你是如何开始调试这样的东西的?

I don't even have any http calls in my app. What gives? How do you even begin to debug something like this?

推荐答案

问题是测试项目是在 Rider 中创建的.在 Visual Studio 中创建测试项目可让您克服此错误.

The issue was that the Test Project was created in Rider. Creating the Test project in visual studio allows you to progress beyond this error.

这篇关于Xamarin.forms 中的 UITests 发布失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆