Getting System.Net.WebException: POST Failed when starting Android (Xamarin Forms) App in Test Cloud

Hi All, I have some UITests that work perfectly against an Android device tethered to my laptop. But when I upload these tests to the Test Cloud they fail across all devices with the following error ...

5-05-2017 03:20:24.933 +02:00 - 194 - Android test running Xamarin.UITest version: 2.0.9
15-05-2017 03:20:24.966 +02:00 - 227 - Using XAMARIN_TEST_CLOUD configuration override.
15-05-2017 03:20:25.820 +02:00 - 1081 - Initializing Android app with apk: /Volumes/Data/xamarin/workspaces/3a940334-2bbf-40de-ae69-a20419416410/workspace/app.apk
15-05-2017 03:23:15.734 +02:00 - 170988 - Exceptions while waiting:
System.Net.WebException: POST Failed
at Xamarin.UITest.Shared.Http.HttpClient.HandleHttpError (System.String method, System.Net.Http.HttpResponseMessage response, ExceptionPolicy exceptionPolicy) <0x558c0e8 + 0x001a3> in :0
at Xamarin.UITest.Shared.Http.HttpClient.SendData (System.String endpoint, System.String method, System.Net.Http.HttpContent content, ExceptionPolicy exceptionPolicy, Nullable1 timeOut) <0x55443c8 + 0x006d7> in <filename unknown>:0 at Xamarin.UITest.Shared.Http.HttpClient.Post (System.String endpoint, System.String arguments, ExceptionPolicy exceptionPolicy, Nullable1 timeOut) <0x5540658 + 0x00097> in :0
at Xamarin.UITest.Shared.Http.HttpClient.Post (System.String endpoint, System.Object arguments, ExceptionPolicy exceptionPolicy, Nullable1 timeOut) <0x55887a0 + 0x0005f> in <filename unknown>:0 at Xamarin.UITest.Android.AndroidGestures.Query[T] (ITokenContainer query, System.Object[] args, System.String methodName) <0x5588000 + 0x0011b> in <filename unknown>:0 at Xamarin.UITest.Android.AndroidGestures.Query (Xamarin.UITest.Queries.AppQuery query) <0x556fea0 + 0x0002f> in <filename unknown>:0 at Xamarin.UITest.Android.AndroidApp.<AndroidApp>m__0 () <0x5587db0 + 0x00037> in <filename unknown>:0 at Xamarin.UITest.Shared.WaitForHelper.WaitFor (System.Func1 predicate, System.String timeoutMessage, Nullable1 timeout, Nullable1 retryFrequency, Nullable`1 postTimeout) <0x5587860 + 0x000fe> in :0
.F.FCompleted run. 23 events collected.

[[[ XTC-Output-Path: '/Volumes/Data/xamarin/workspaces/3a940334-2bbf-40de-ae69-a20419416410/workspace/tmp/TestRun-20170515-012315-7562' ]]]

Tests run: 2, Errors: 0, Failures: 2, Inconclusive: 0, Time: 171.0278562 seconds
Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0

Errors and Failures:
1) SetUp Error : FieldTaskObs.UITests.Tests(Android)
SetUp : System.TimeoutException : Timed out waiting...
at Xamarin.UITest.Shared.WaitForHelper.WaitFor (System.Func1 predicate, System.String timeoutMessage, Nullable1 timeout, Nullable1 retryFrequency, Nullable1 postTimeout) <0x5587860 + 0x004db> in :0
at Xamarin.UITest.Android.AndroidApp..ctor (IAndroidAppConfiguration appConfiguration, IExecutor executor) <0x4d86ba0 + 0x00777> in :0
at Xamarin.UITest.Android.AndroidApp..ctor (IAndroidAppConfiguration appConfiguration) <0x4d86b60 + 0x0001f> in :0
at Xamarin.UITest.Configuration.AndroidAppConfigurator.StartApp (AppDataMode appDataMode) <0x4d850b8 + 0x00063> in :0
at FieldTaskObs.UITests.AppInitializer.StartApp (Platform platform) <0x4d84110 + 0x0002f> in :0
at FieldTaskObs.UITests.Tests.BeforeEachTest () <0x4d84030 + 0x00023> in :0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) <0x3258110 + 0x00093> in :0

Basically it's failing at the very beginning in the Test Fixture Setup at this line .... (and yes in this case platform == platform.Android)

            app = AppInitializer.StartApp(platform);

Which then calls ...

public class AppInitializer
{
    public static IApp StartApp(Platform platform)
    {
        if (platform == Platform.Android)
        {
            return ConfigureApp.Android.StartApp();
        }

        return ConfigureApp.iOS.StartApp();
    }
}

I've scoured the forums but can't see any solutions that assist. Just wondering if anyone else has experienced this or found a solution?

Answers

  • AmyCaveAmyCave USMember ✭✭

    I have seen something similar happen to some of the devices I have used in test cloud. My tests will run fine on all selected devices and then get this on one of them. Somewhat frustrating. Not sure the cause, as the same tests on that same device that failed will sometimes run ok for me.
    I guess does the number of devices selected? Which devices?
    What time of day are the test uploaded to test cloud and run?
    How does Xamarin update the devices in the test cloud?

  • JohnMoyJohnMoy AUMember ✭✭

    Hi Amy, sorry for late reply.
    I'm testing across 5 iOS devices. I might try what you suggested and shift the time of day this executes, and the number of devices. I'm finding the error seems to randomly occur one day on one device, and then shifts to another device on another day.

Sign In or Register to comment.