calabash-ios and monotouch problem

341 views
Skip to first unread message

Ryan Boucher

unread,
Sep 19, 2012, 7:52:42 PM9/19/12
to calaba...@googlegroups.com
Hiya,

brief
I can compile calabash-ios into a monotouch project; the server appears to start twice (!?) and cucumber can't connect to it.

I'd like to know of what else I can try to get these two playing nicely together.


full story
I'm trying to get calabash-ios working monotouch (i've got it the android side working fine). The trick with monotouch is that it auto-generates new xcodeproj whenever it needs to. This means that the calabash-ios gen stage can't be done reliably.

So I went down the manual installation path. I copied the calabash.framework folder into the root path of the project and updated the monotouch project options to include the following arguments: -gcc_flags "-force_load /Users/rboucher/projects/HelloMono/MonoForIPhone/calabash.framework/calabash -framework CFNetwork -framework CoreGraphics -lstdc++". I had to add the CoreGraphics framework to as it wouldn't build without it. This now builds and when I start the app (in the monodevelop IDE) I get the following in the output.

2012-09-20 09:13:08.294 MonoForIPhone[16188:c07] Creating the server: <LPHTTPServer: 0x9c13160>
2012-09-20 09:13:08.295 MonoForIPhone[16188:c07] simroot: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk
2012-09-20 09:13:08.296 MonoForIPhone[16188:c07] Started LPHTTP server on port 37265
2012-09-20 09:13:08.457 MonoForIPhone[16188:2007] Creating the server: <LPHTTPServer: 0x9c56ba0>
2012-09-20 09:13:08.458 MonoForIPhone[16188:2007] simroot: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk
2012-09-20 09:13:08.459 MonoForIPhone[16188:2007] Error starting LPHTTP Server: Error Domain=NSPOSIXErrorDomain Code=48 "Address already in use" UserInfo=0x9e57450 {NSLocalizedFailureReason=Error in bind() function, NSLocalizedDescription=Address already in use}

I find the server starting twice a potential smell. If I close the simulator and run cucumber from commandline. The simulator is started with the correct app but never establishes a connection. Here is the output.

Feature: Login feature

  Scenario: Default     # features/my_first.feature:3
#<Timeout::Error: Timeout::Error>


I can bundle this all onto github if anyone wants/needs to take a look at it, the app is nothing more than a single page that contains a button and a label.


Thanks,
Ryan

Krukow

unread,
Sep 20, 2012, 4:58:26 AM9/20/12
to calaba...@googlegroups.com
Hi Ryan,
Thanks for the detailed report. I'd really like to fully support mono touch as it matches the goals of Calabash very well (cross-platform development+test).

I don't know what happens in the compiler and runtime in mono, but the fact that the HTTP server is starting twice is an indication that the C++ static initializer is running twice which is unsound - could mono be the source of this, or is it more likely the way you setup your project?


Alternatively you could try and compile a custom version of Calabash Server which doesn't use the C++ static initializer above. Just to make it work you could start the server manually.

You're also welcome to put the reference project in github. But I don't know when I will have time to look at it.

- Karl

Ryan Boucher

unread,
Sep 20, 2012, 8:44:21 PM9/20/12
to calaba...@googlegroups.com
Thanks Karl.

I've asked the MonoTouch peeps their thoughts (pending post approval). I'll wait to hear from them before I try forking calabash as my objective-c skills aren't great. I dropped my code here: https://github.com/distributedlife/mono_android_ios_calabash

Thanks again and I'll let you know what the mono peeps suggest and if I manage to get it all playing nicely.

appsr

unread,
Jul 11, 2013, 10:35:57 PM7/11/13
to calaba...@googlegroups.com
Hi,

I am also using Xamarin studio for Monotouch and using Calabash IOS for testing. I did forceload the Calabash framework, but I do not see the test server starting when I run it in the simulator.

  <MtouchExtraArgs>-gcc_flags "-framework CFNetwork -framework CoreGraphics -force_load $(ProjectDir)/calabash.framework/calabash -lstdc++"</MtouchExtraArgs>

Is there any other setup that I have to do other than downloading Calabash framework in the project directory and configuring this? I see from the output window that test server didnt start and also when launching the console and doing query says the error could not connect.
Reply all
Reply to author
Forward
0 new messages