Forum Xamarin Test Cloud (Read Only)

iOS Test Recorder - Exception thrown trying to kill existing calabash server

I'm having issues getting the Test Recorder running with my application. I am using Visual Studio on windows to manage the app. When I select to run the app in Test Recorder I receive the below error. I've tried a bunch of different things in an attempt to resolve the issue but have not been able to.

[07:42:50] Checking the recorder plugin version on start app
[07:48:45] Injecting calabash into iOS app
[07:48:45] Installing /var/folders/wg/x45q_jp92k3f9gk7z22wmt7m0000gn/T/test-recorder/ios-injection/calabash.dylib
[07:48:45] Linking calabash.dylib
[07:48:45] Installing /var/folders/wg/x45q_jp92k3f9gk7z22wmt7m0000gn/T/test-recorder/ios-injection/recorderPluginCalabash.dylib
[07:48:47] Exception thrown trying to kill existing calabash server
[07:48:47] An error occurred while sending the request

I saw there is an option to link calabash within the app, but have not found a way to accomplish this in VS on windows.

Any help would be greatly appreciated :)

Best Answers

Answers

  • Kent.GreenKent.Green USXamarin Team Xamurai

    I have a few questions:

    1. Are you attempting to use Test Recorder with an IPA for a device or an .app file for a simulator?
    2. If on a device, are you able to manually sign the IPA & run it on the device using the same Mac you are trying to use with Test Recorder?
    3. What iOS version & Model are you trying to test on?
    4. Are you using the latest Dev version of Test Recorder on Mac?

    As a workaround, you should be able to add Calabash in Visual Studio on Windows by following the steps in this guide: https://developer.xamarin.com/guides/testcloud/uitest/adding-uitest/#Adding_the_Xamarin_Test_Cloud_Agent_to_the_iOS_Project

    The steps are essentially the same on both Mac & Windows; you have to add the Xamarin Test Cloud Agent NuGet package to your project & start the Calabash server in your FinishedLaunching method. However, even though you can set this up in Windows, you will not be able to run iOS Xamarin.UITests locally on Windows, because that is not supported.

  • Ryan.ERyan.E USMember
    1. The above error message was from an .app file for the simulator. I also tried with an .ipa with a different error "Failed to install app to device exit code: 134". Based on other messages in the logs it seems like it is having trouble resigning the app "replacing existing signature"
    2. Not sure what you mean by "manually sign", I am able to build and run the app on a device and simulator (using the same mac).
    3. iPad Pro 12.9" iOS version 10.3.2
    4. Test Recorder 1.1.14

    I also tried creating a blank Xamarin project on the mac using Visual studio to hopefully rule out issues with my application. Without making any changes to the project, I was able to deploy to a device and the simulator through VS (on mac). When I tried to run it through the test recorder both failed the same as my main app. So starting to think there is something wrong with the Test Recorder.

    Thank you for the reply, I'll give the link a go hopefully it will solve my issues.

  • Kent.GreenKent.Green USXamarin Team Xamurai

    Test Recorder has to resign the IPA in order to inject Calabash, and it will always attempt to do it; but it can only be successful if it's on a system with access to a valid provisioning profile & identity. So when I asked about "manually signing" I was thinking about if you're able to sign/run the IPA on a physical iOS device from the same Mac, just without running it through Test Recorder.

    I have two followup questions based on your observations with the iOS simulator:
    1. Can you try updating to Test Recorder 1.1.15? Go to Xamarin Test Recorder > Check for Updates > Dev channel. I think there were a few iOS-specific fixes there; though not all issues.
    2. If updating doesn't help, can you see if you still reproduce the issue when targeting an iOS 8 or 9 simulator instead? There were a lot of automation changes applied in iOS 10, so the problem might be specific to that version.

    Thanks in advance!
    -Kent

  • Ryan.ERyan.E USMember

    1) Updated to Recorder to 1.1.15, didn't fix it.
    2) Downloaded iOS simulator 9.3. Same results :(

    Do you think it could have something to do with my Ruby install? Maybe calabash-sandbox? Throwing crap at the wall at this point :|

  • Kent.GreenKent.Green USXamarin Team Xamurai

    I'm not seeing any known issues that might be related to Ruby or the Calabash-Sandbox. I did some quick tests to see if I could reproduce the issue on my end, but so far I am unable to.

    1. Do you still see the issue if you try it with a new iOS template app, or is it exclusive to your actual production app?
    2. What version of Xcode are you running? Does it match the version set in "Xcode -> Preferences -> Locations -> Command Line Tools"?
  • Ryan.ERyan.E USMember
    1. So yesterday I wasn't able to get any of the default projects working. Today I have all the template projects running fine, but my production app still doesn't connect. I did end up Resetting the simulator which seemed to resolve the issues with the default applications - Simulator -> Reset Content and Settings
    2. They are the same version - 8.3.3

    I'm going to try and compare the two different projects to see if I can isolate the problem with my production application. The project is a few years old at this point so it's possible the config files are missing something.

    Also, the title of the forum post seems kind of pointless now. The recorder throws an exception if a Calabash Server isn't currently running. So basically every time you first link the Test Recorder it throws the "Exception thrown trying to kill existing calabash server".

  • RyanEhrlerRyanEhrler USMember ✭✭

    I believe I have the issue narrowed down to code in my ViewController which implements UIViewController.

    public override void ViewDidLoad()
            {
                base.ViewDidLoad();
    
                var script = new WKUserScript(new NSString(JavaScriptFunction), WKUserScriptInjectionTime.AtDocumentEnd, false);
                userController = new WKUserContentController();
                userController.AddUserScript(script);
                userController.AddScriptMessageHandler(this, "invokeAction");
                var config = new WKWebViewConfiguration { UserContentController = userController };
                webView = new WKWebView(View.Frame, config);
                //setup navigationDelegate
                webView.NavigationDelegate = new NavigationDelegate();
    
    
                var url = new NSUrl(Url.address);
                var request = new NSUrlRequest(url);
                webView.LoadRequest(request);
    
                View.AddSubview(webView);
    
                /* Display logo image until webview loads */
                var imageView = new UIImageView(UIImage.FromBundle("Default-Landscape.png"));
                imageView.Frame = new CoreGraphics.CGRect(0, 0, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height);
                View.AddSubview(imageView);
    }
    

    The issue seems to be related to the webView.LoadRequest() line. When I comment this out the Test Recorder connects just fine.

    Does this ring any bells?

  • Ryan.ERyan.E USMember

    1) Updated to Recorder to 1.1.15, didn't fix it.
    2) Downloaded iOS simulator 9.3. Same results :(

    Do you think it could have something to do with my Ruby install? Maybe calabash-sandbox? Throwing crap at the wall at this point :|

    [07:54:04] Installing /var/folders/wg/x45q_jp92k3f9gk7z22wmt7m0000gn/T/test-recorder/ios-injection/recorderPluginCalabash.dylib
    [07:54:06] Exception thrown trying to kill existing calabash server
    [07:54:06] An error occurred while sending the request
    [07:54:06] at System.Net.Http.HttpClientHandler+c__async0.MoveNext () [0x00486] in :0
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in :0
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in :0
    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in :0
    at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <f907cb1a62cf4887ae8c2f003ce661d7>:0 at System.Net.Http.HttpClient+<SendAsyncWorker>c__async0.MoveNext () [0x000f3] in <df0e9b6c0f494a4f9f0da4678d8bfe91>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <f907cb1a62cf4887ae8c2f003ce661d7>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <f907cb1a62cf4887ae8c2f003ce661d7>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <f907cb1a62cf4887ae8c2f003ce661d7>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <f907cb1a62cf4887ae8c2f003ce661d7>:0 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in :0
    at Xamarin.TestRecorder.Portable.iOS.iOSRecordingSession+d__11.MoveNext () [0x0030e] in :0
    [07:54:14] Failed starting app: Failed to find connected iOS devices.
    [07:54:14] at Xamarin.UITest.Shared.iOS.Queries.QueryConnectediOSDevices.Execute () [0x00022] in :0
    at Xamarin.UITest.Shared.Execution.Executor+c__AnonStorey01[TResult].<>m__0 () [0x00000] in <b2dbb1bd4b224d63be0561fef2070e3b>:0 at Xamarin.UITest.Shared.Execution.Executor.WrapQuery[TResult] (System.Func1[TResult] queryFunc) [0x00000] in :0
    at Xamarin.UITest.Shared.Execution.Executor.Execute[TResult] (Xamarin.UITest.Shared.Execution.IQuery`1[TReturn] query) [0x0001a] in :0
    at Xamarin.UITest.iOS.iOSAppLauncher.GetOrValidateSimId (Xamarin.UITest.iOS.Instruments instruments, System.String deviceIdentifier) [0x00049] in :0
    at Xamarin.UITest.iOS.iOSAppLauncher.LaunchAppLocal (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration, Xamarin.UITest.Shared.Http.HttpClient httpClient, System.Boolean clearAppData) [0x00122] in :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 :0
    at Xamarin.UITest.iOS.iOSApp..ctor (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration, Xamarin.UITest.Shared.Execution.IExecutor executor) [0x002de] in :0
    at Xamarin.UITest.iOS.iOSApp..ctor (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration) [0x00000] in :0
    at Xamarin.UITest.Configuration.iOSAppConfigurator.StartApp (Xamarin.UITest.Configuration.AppDataMode appDataMode) [0x00017] in :0
    at Xamarin.TestRecorder.Portable.iOS.iOSRecordingSession+d__11.MoveNext () [0x003c6] in :0

  • Ryan.ERyan.E USMember

    Error message for above post

    [07:54:04] Installing /var/folders/wg/x45q_jp92k3f9gk7z22wmt7m0000gn/T/test-recorder/ios-injection/recorderPluginCalabash.dylib
    [07:54:06] Exception thrown trying to kill existing calabash server
    [07:54:06] An error occurred while sending the request
    [07:54:06] at System.Net.Http.HttpClientHandler+c__async0.MoveNext () [0x00486] in :0
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in :0
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in :0
    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in :0
    at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <f907cb1a62cf4887ae8c2f003ce661d7>:0 at System.Net.Http.HttpClient+<SendAsyncWorker>c__async0.MoveNext () [0x000f3] in <df0e9b6c0f494a4f9f0da4678d8bfe91>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <f907cb1a62cf4887ae8c2f003ce661d7>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <f907cb1a62cf4887ae8c2f003ce661d7>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <f907cb1a62cf4887ae8c2f003ce661d7>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <f907cb1a62cf4887ae8c2f003ce661d7>:0 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in :0
    at Xamarin.TestRecorder.Portable.iOS.iOSRecordingSession+d__11.MoveNext () [0x0030e] in :0
    [07:54:14] Failed starting app: Failed to find connected iOS devices.
    [07:54:14] at Xamarin.UITest.Shared.iOS.Queries.QueryConnectediOSDevices.Execute () [0x00022] in :0
    at Xamarin.UITest.Shared.Execution.Executor+c__AnonStorey01[TResult].<>m__0 () [0x00000] in <b2dbb1bd4b224d63be0561fef2070e3b>:0 at Xamarin.UITest.Shared.Execution.Executor.WrapQuery[TResult] (System.Func1[TResult] queryFunc) [0x00000] in :0
    at Xamarin.UITest.Shared.Execution.Executor.Execute[TResult] (Xamarin.UITest.Shared.Execution.IQuery`1[TReturn] query) [0x0001a] in :0
    at Xamarin.UITest.iOS.iOSAppLauncher.GetOrValidateSimId (Xamarin.UITest.iOS.Instruments instruments, System.String deviceIdentifier) [0x00049] in :0
    at Xamarin.UITest.iOS.iOSAppLauncher.LaunchAppLocal (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration, Xamarin.UITest.Shared.Http.HttpClient httpClient, System.Boolean clearAppData) [0x00122] in :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 :0
    at Xamarin.UITest.iOS.iOSApp..ctor (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration, Xamarin.UITest.Shared.Execution.IExecutor executor) [0x002de] in :0
    at Xamarin.UITest.iOS.iOSApp..ctor (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration) [0x00000] in :0
    at Xamarin.UITest.Configuration.iOSAppConfigurator.StartApp (Xamarin.UITest.Configuration.AppDataMode appDataMode) [0x00017] in :0
    at Xamarin.TestRecorder.Portable.iOS.iOSRecordingSession+d__11.MoveNext () [0x003c6] in :0

Sign In or Register to comment.