Forum Xamarin Test Cloud (Read Only)

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Would somebody be willing to help me troubleshoot this problem with DeviceAgentException?

BJAberleBJAberle USMember

This is my first project with Xamarin and UITest and I have been able to get the UITest project up and running on my own so far and have been able to fix most of my problems. But this one has me at a loss. My tests had been running and executing fine locally until last week when I started working on trying to get some tests to run via command line. I ran an msbuild script to build the project which built fine. But after that (not sure if it had anything to do with it) my tests would not run locally. Test results come back with the following error:

Calabash.XDB.Core.Exceptions.DeviceAgentException : Unable to contact DeviceAgent
  ----> System.AggregateException : One or more errors occurred.
  ----> Calabash.XDB.Core.Exceptions.DeviceAgentException : Unable to contact DeviceAgent on 127.0.0.1
  ----> System.MissingFieldException : Field 'System.Net.HttpWebRequest.ResendContentFactory' not found.

The project is a Xamarin.Forms (6.1.2 b44) project with iOS and Android builds. I am running Xcode 8.2
I have tried deleting the xdb folder and running to no avail.

Any help is greatly appreciated!

Answers

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai

    @BJAberle,

    Could you confirm you are having this issue with the latest UITest version and Test Cloud Agent version?

  • BJAberleBJAberle USMember

    @JohnMiller
    I am having the issue with the latest versions of both. Tried downgrading both also but was running into the same behavior, It seems like the deviceAgent is trying to launch but then just times out in the simulator. Except on those occasions the error message was just:

    ---> System.MissingFieldException : Field 'System.Net.HttpWebRequest.ResendContentFactory' not found.

  • BJAberleBJAberle USMember

    Happy New Year @JohnMiller !!! It looks like other people on here are having some similar (related maybe?) issues regarding the DeviceAgent. I have yet to find a solution for this. I completely uninstalled and reinstalled and am still getting the same errors. Is there other information that would be of help that I could provide for you? Thanks!

  • BJAberleBJAberle USMember

    Also, I was using Charles Proxy for some testing prior to this and am wondering if it did not release a port properly.

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai

    Hi @BJAberle,

    Searches for known issues came up empty so far. What's interesting is that local tests worked OK until you started trying from the command line - correct?

    Can you confirm if IDE runs work? If so, check the output for what the command is being used. You might be able to see some differences from what you're doing. Can you share the entire command you are using?

  • BJAberleBJAberle USMember

    @JohnMiller You are correct, I could run tests from the IDE just fine until I started trying through the command line. I cannot run UI tests from the IDE, but I can build and run the app normally in the IDE. What happens now when I run the test in the IDE is that it will launch the simulator and then attempt to launch the DeviceAgent but just hang on a black screen.

    Here is the command I was using to launch:
    NUNIT-CONSOLE /Users/username/Development/appname.mobileapp/LearningLibrary.UITests/bin/Debug/LearningLibrary.UITests.dll -fixture=Tests -run=AppLaunches

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai

    @BJAberle,

    Thanks for confirming. Would you upload you version info from XS -> About Xamarin Studio -> Show Details -> Copy Information?

  • BJAberleBJAberle USMember
    edited January 2017

    @JohnMiller Absolutely. Please let me know if there is any other information you need.

    === Xamarin Studio Community ===

    Version 6.1.3 (build 19)
    Installation UUID: e92658c8-1119-4354-8299-7a0828d60bca
    Runtime:
    Mono 4.6.2 (mono-4.6.0-branch/ac9e222) (64-bit)
    GTK+ 2.24.23 (Raleigh theme)

    Package version: 406020016
    

    === NuGet ===

    Version: 3.4.3.0

    === Xamarin.Profiler ===

    Not Installed

    === Xamarin.Android ===

    Version: 7.0.2.42 (Xamarin Studio Community)
    Android SDK: /Users/bjaberle/Library/Developer/Xamarin/android-sdk-macosx
    Supported Android versions:
    5.1 (API level 22)
    6.0 (API level 23)
    7.0 (API level 24)

    SDK Tools Version: 25.2.2
    SDK Platform Tools Version: 25
    SDK Build Tools Version: 25

    Java SDK: /usr
    java version "1.8.0_25"
    Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
    Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

    Android Designer EPL code available here:
    https://github.com/xamarin/AndroidDesigner.EPL

    === Xamarin Android Player ===

    Not Installed

    === Apple Developer Tools ===

    Xcode 8.2.1 (11766.1)
    Build 8C1002

    === Xamarin.iOS ===

    Version: 10.3.1.7 (Xamarin Studio Community)
    Hash: 8b53676
    Branch: cycle8-xi
    Build date: 2016-12-18 12:23:27-0500

    === Xamarin.Mac ===

    Version: 2.10.0.120 (Xamarin Studio Community)

    === Xamarin Inspector ===

    Version: 1.0.0.0
    Hash: 1f3067d
    Branch: master
    Build date: 11/15/2016 3:13:59 PM

    === Build Information ===

    Release ID: 601030019
    Git revision: 7fabf9293c2d7b638e28a07f798d21799da1f886
    Build date: 2016-12-21 07:08:35-05
    Xamarin addins: efbae0e683a0060d2230e91e70c1598abc054845
    Build lane: monodevelop-lion-cycle8

    === Operating System ===

    Mac OS X 10.12.0
    Darwin rpxair02-2.ionagroup.local 16.0.0 Darwin Kernel Version 16.0.0
    Mon Aug 29 17:56:20 PDT 2016
    root:xnu-3789.1.32~3/RELEASE_X86_64 x86_64

    === Enabled user installed addins ===

    Xamarin Inspector 1.0.0.0

  • BJAberleBJAberle USMember

    Happy New Year @JohnMiller !!! It looks like other people on here are having some similar (related?) issues regarding the DeviceAgent. I have yet to find a solution for this. Including stack trace to see if it elucidates any ideas from you or your team. Thanks for your help!

      at Calabash.XDB.Core.Services.iOSDeviceAgentService+<LaunchTestAsync>d__16.MoveNext () [0x0023e] in <b73cff4a2397440784b826df8244b425>:0 
    --- End of stack trace from previous location where exception was thrown ---
      at Xamarin.UITest.iOS.iOSAppLauncher.LaunchAppLocal (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration, Xamarin.UITest.Shared.Http.HttpClient httpClient, System.Boolean clearAppData) [0x0020a] in <b73cff4a2397440784b826df8244b425>:0 
      at Xamarin.UITest.iOS.iOSAppLauncher.LaunchApp (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration, Xamarin.UITest.Shared.Http.HttpClient httpClient, Xamarin.UITest.TestCloud.TestCloudiOSAppConfiguration testCloudAppConfiguration, Xamarin.UITest.Shared.Http.HttpClient testCloudWsClient, Xamarin.UITest.Shared.Http.HttpClient xtcServicesClient, System.Boolean testCloudUseDeviceAgent) [0x0007a] in <b73cff4a2397440784b826df8244b425>:0 
      at Xamarin.UITest.iOS.iOSApp..ctor (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration) [0x00302] in <b73cff4a2397440784b826df8244b425>:0 
      at Xamarin.UITest.Configuration.iOSAppConfigurator.StartApp (Xamarin.UITest.Configuration.AppDataMode appDataMode) [0x00017] in <b73cff4a2397440784b826df8244b425>:0 
      at LearningLibrary.UITests.AppInitializer.StartApp (Xamarin.UITest.Platform platform) [0x00024] in /Users/bjaberle/Development/cttsotfo.mobileapp/LearningLibrary.UITests/AppInitializer.cs:60 
      at LearningLibrary.UITests.Tests.BeforeEachTest () [0x00008] in /Users/bjaberle/Development/cttsotfo.mobileapp/LearningLibrary.UITests/Tests.cs:42 
      at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
      at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/MonoMethod.cs:305 
    --AggregateException
    
    --DeviceAgentException
      at Calabash.XDB.Core.Services.iOSDeviceAgentService+<PingAsync>d__18.MoveNext () [0x000ed] in <b73cff4a2397440784b826df8244b425>:0 
    --MissingFieldException
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].Start[TStateMachine] (TStateMachine& stateMachine) [0x00031] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:471 
      at System.Net.Http.HttpClientHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00024] in <41c316444c8a4380b9344ba09eeb18de>:0 
      at System.Net.Http.HttpMessageInvoker.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00000] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.Net.Http/System.Net.Http/HttpMessageInvoker.cs:68 
      at System.Net.Http.HttpClient.<SendAsync>__BaseCallProxy0 (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00000] in <41c316444c8a4380b9344ba09eeb18de>:0 
      at System.Net.Http.HttpClient+<SendAsyncWorker>c__async0.MoveNext () [0x00071] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:272 
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
      at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
      at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535 
      at Calabash.XDB.Core.Services.HttpService+<>c__DisplayClass7_0`1+<<GetAsync>b__0>d[T].MoveNext () [0x00084] in <b73cff4a2397440784b826df8244b425>:0 
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
      at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
      at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535 
      at Calabash.XDB.Core.Services.HttpService+<ExecuteRequestAsync>d__12.MoveNext () [0x00084] in <b73cff4a2397440784b826df8244b425>:0 
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
      at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
      at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535 
      at Calabash.XDB.Core.Services.HttpService+<RequestAsync>d__11`1[T].MoveNext () [0x000d5] in <b73cff4a2397440784b826df8244b425>:0 
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
      at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
      at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535 
      at Calabash.XDB.Core.Services.HttpService+<GetAsync>d__7`1[T].MoveNext () [0x000fd] in <b73cff4a2397440784b826df8244b425>:0 
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
      at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
      at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535 
      at Calabash.XDB.Core.Services.iOSDeviceAgentService+<PingAsync>d__18.MoveNext () [0x000bb] in <b73cff4a2397440784b826df8244b425>:0
    
  • Kent.GreenKent.Green USXamarin Team Xamurai

    @BJAberle I noticed something strange happened and your post seemed to be duplicated a dozen times; I deleted the extra copies of those except for your first one.

    Some quick questions for your issue:
    1. Can you tell us what iOS version & model you're using in the simulator when it fails?
    2. Does your app launch & run normally in the simulator except for the fact that automation is failing?

  • BJAberleBJAberle USMember

    @KentGreen @JohnMiller Thanks for taking care of the extra copies. I remember having some issues getting that post to submit successfully.

    1. For iOS I usually run an iPhone 7 Plus 10.2 and an iPhone 6 Plus 9.2. But it doesn't make a difference really because none of my simulators seem to be able to connect to the DeviceAgent. (Same goes for my Android emulators)
    2. Yes, the app will launch & run normally in the simulator when launching in the IDE. If I try to run tests from the IDE I get the error described in previous posts.

    Thanks for your help!!

  • BJAberleBJAberle USMember

    @KentGreen @JohnMiller any thoughts about this? I am going to have to start writing my test suites and need to have this working. I may try to pull one of our developers in on this as well to help me, so any direction would be greatly appreciated!

  • Kent.GreenKent.Green USXamarin Team Xamurai

    Hi @BJAberle I have a few questions/tests:

    1. Does the "DeviceAgent" app appear to be installed on any of the iOS simulators you've tried? It should look like any app without an icon on the Simulator, with "DeviceAgent" as the name. (It can't be run like a normal app though.)

    2. Have you tried going to "Simulator" -> "Reset Contents & Settings", then reinstalling your iOS app & attempting to run the tests again?

    3. Are you initializing the Test Cloud agent as mentioned in this guide? https://developer.xamarin.com/guides/testcloud/uitest/adding-uitest/#Initialize_the_Xamarin_Test_Cloud_Agent

    4. You mentioned in your OP that the app is a Forms app for Android / iOS. Have you tried running UITests against the Android version and do they work?

    Cheers,
    -Kent

  • BJAberleBJAberle USMember

    @KentGreen
    1. Yes the DeviceAgent app appears to be installed on the iOS simulators
    2. Reset Content & Settings, reinstalled and ran the tests again with no success
    3. TestCloudAgent is being initialized as per the documentation
    4. For the Android test, I get the following error message:
    System.MissingFieldException : Field 'System.Net.HttpWebRequest.ResendContentFactory' not found.

    For the iOS test, I receive the following:
    Calabash.XDB.Core.Exceptions.DeviceAgentException : Unable to contact DeviceAgent
    ----> System.AggregateException : One or more errors occurred.
    ----> Calabash.XDB.Core.Exceptions.DeviceAgentException : Unable to contact DeviceAgent on 127.0.0.1
    ----> System.MissingFieldException : Field 'System.Net.HttpWebRequest.ResendContentFactory' not found.

    Both platforms report that they cannot find System.Net.HttpWebRequest.ResendContentFactory
    I would also expect ----> Calabash.XDB.Core.Exceptions.DeviceAgentException : Unable to contact DeviceAgent on 127.0.0.1 to have a port on the IP address.

    My tests were running and completing without error until I started to try to run tests via the command line through nunit-console

    Thanks.

  • Kent.GreenKent.Green USXamarin Team Xamurai

    So if I'm understanding you correctly, are you saying that the UITests worked properly when running inside Xamarin Studio?

    Can you give us an example command line you're using to upload the tests? (If you need to omit certain paths or filenames that's probably okay, but please let us know where you're doing that & what types of files they'd point to.)

  • BJAberleBJAberle USMember

    @KentGreen
    Your understanding is correct. Tests were working as expected. The nunit command was:

    NUNIT-CONSOLE /Users/bjaberle/Development/cttsotfo.mobileapp/LearningLibrary.UITests/bin/Debug/LearningLibrary.UITests.dll -fixture=Tests -run=AppLaunches

    Which seemed to launch correctly, just not finding my test fixture though (I was troubleshooting that when I realized that my tests in the IDE were no longer working)

    As I was writing this I do recall that I did try to run the actual project .dll with nunit in error until I realized I needed to run the command on the UITests.dll

    NUNIT-CONSOLE /Users/bjaberle/Development/cttsotfo.mobileapp/LearningLibrary.Core/bin/Debug/LearningLibrary.Core.dll
    I ran this a couple of times initially before I realized this was the wrong dir.

  • Kent.GreenKent.Green USXamarin Team Xamurai

    @BJAberle thanks for the update, and my apologies but I see you covered some of that info earlier in the thread with John.

    I'm not as familiar with running UITests locally in the command line myself, but after trying some experiments I found that I was missing the .InstalledApp() argument, which is required to be set for running in the command line locally, but is not required to run in Xamarin Studio (if part of the same solution and referencing the app project) or when uploading to the Test Cloud.

    Have you set the .InstalledApp() method?

    Here's an example of what I set to target an iOS simulator with the app already installed; I set this in the AppIntializer.cs file autogenerated when creating a multi-platform UITest project from the template in Xamarin Studio:

    return ConfigureApp
                    .iOS
                    .InstalledApp ("com.companyname.formspaperscissors")
                    .StartApp ();
    

    In that case the string is my bundle identifier set in the info.plist. You can instead point to a local copy of the compiled .app or IPA with Calabash linked in and that matches the version installed on the device or simulator. Usually when you create an IPA through the Archive function you can customize where you save it, but for the .app file it will generally be found in the iOS project > bin > iPhoneSimulator folder.

    (You can also use .AppBundle () or .AppBundleZip (), but either of these only work for iOS simulators, vs. .InstalledApp() works both the device and simulator.)

  • BJAberleBJAberle USMember

    @KentGreen I tried running command line again with the .InstalledApp() but no success. I did not have that for the IDE tests and they ran successfully when it was working.

    I did find these issues that seem to be similar. Not sure if they would help your investigation.

    https://github.com/couchbase/couchbase-lite-net/issues/777

    https://github.com/paulcbetts/ModernHttpClient/issues/228

  • Kent.GreenKent.Green USXamarin Team Xamurai
    edited January 2017

    .InstalledApp() is not required to run tests in the IDE, but is required to run tests via the command line. (It can be used in the IDE to point to an app though, if for example you're running a test against a pre-built IPA or .apk instead of against another project in the same solution.)

    I take it your app is using CouchBase & ModernHttpClient? If you suspect that's part of the cause, you could try creating a new app from a template, update the packages and see if you still encounter the issue:

    1. Go to "Create a new project -> Multiplatform App -> Forms App"
    2. On the next page, "Configure your Forms App" you can set the app name and bundle identifier that you'll use later; (or you can change / check it in the info.plist file.)
    3. On the next page "Configure your new project" make sure at the bottom "Add an automated UI test project" is selected. You can add one manually but this will save you some effort.
    4. It might work with the current template packages, but as a habit I always update to the latest versions of all the packages (except NUnit in the UITest project which should be 2.6.4)
    5. Build & deploy the app on your test device or simulator, then run the UITest in Xamarin Studio just to make sure it's working as expected.
    6. Add the InstalledApp() method like I described in my previous post.
    7. Finally, attempt to run the test from the command line against the device or simulator you already installed the app on.

    Results

    If the template app works in the command line then it could be the issue is a specific problem with your original project itself; perhaps relating to the components in your latest hypothesis.

    If the template app does not work in the command line, then it's possible the issue is related to your environment or setup somehow.

Sign In or Register to comment.