Running Local Test on Real Device using Xamarin UITest Fails

I have a test fixture that contains several tests. When I run this test fixture in Test Cloud it works fine, but when I run locally the first test succeeds, but all subsequent tests fail with this message:

"SetUp : System.Net.Http.HttpRequestException : An error occurred while sending the request.
----> System.Net.WebException : The underlying connection was closed: The connection was closed unexpectedly."

I included the stack trace below. It's like it can't launch the app for the other tests. I'm using Visual Studio 2015 and running the test using Test Explorer.

Result StackTrace:
at Xamarin.UITest.Shared.Http.HttpClient.SendData(String endpoint, String method, HttpContent content, ExceptionPolicy exceptionPolicy, Nullable`1 timeOut)
at Xamarin.UITest.Shared.Http.HttpClient.PostUntilExpectedResultReceived(String endpoint, String arguments, String expectedContent, Int32 retries)
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.Shared.Android.LocalAndroidAppLifeCycle.LaunchApp(ApkFile appApkFile, ApkFile testServerApkFile, Int32 testServerPort)
at Xamarin.UITest.Android.AndroidApp..ctor(IAndroidAppConfiguration appConfiguration, IExecutor executor)
at Xamarin.UITest.Configuration.AndroidAppConfigurator.StartApp(AppDataMode appDataMode)
at PerfectRoomTest.AppInitializer.StartApp(Platform platform) in C:\Projects\PerfectRoomXamarin\PerfectRoom-Branch\PerfectRoomTest\AppInitializer.cs:line 15
at PerfectRoomTest.Tests.BeforeEachTest() in C:\Projects\PerfectRoomXamarin\PerfectRoom-Branch\PerfectRoomTest\Tests.cs:line 43
--WebException
at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)
at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar)
Result Message:
SetUp : System.Net.Http.HttpRequestException : An error occurred while sending the request.
----> System.Net.WebException : The underlying connection was closed: The connection was closed unexpectedly.

Tagged:

Answers

Sign In or Register to comment.