UITests Post Failed in Xamarin.forms

泪湿孤枕 提交于 2021-02-10 11:49:07

问题


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.

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()

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>

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


回答1:


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.



来源:https://stackoverflow.com/questions/57895653/uitests-post-failed-in-xamarin-forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!