Calabash-ios is a popular testing framework. In one of my previous posts, I discussed how to setup Calabash-android on windows. Calabash-ios setup on mac is lot simpler to setup if you are using Xcode as out of the box the fast track calabash-ios setup Option is provided which configures the xcode for you. But if you happen to
use Xamarin studio on Mac, then you have to do manual setup, but its easy to configure.
Assuming you have successfully setup the Calabash-cucumber gem in your mac machine,
the following are the steps for Xamarin ios project.
1. Download the Calabash-framework in the project directory(i.e the path where your .csproj
file is present). In the Terminal, go to the project directory path and type calabash-ios download.
This would download the Calabash-framework directory which you would use in step 2.
1. Download the Calabash-framework in the project directory(i.e the path where your .csproj
file is present). In the Terminal, go to the project directory path and type calabash-ios download.
This would download the Calabash-framework directory which you would use in step 2.
and it didnt work correctly(as of July 13 2013). Copy the downloaded folder to the project
directory(i.e the path where your .csproj file is present)
2. In the Xamarin studio, on the IOS project of your app(say Myapp.ios.csproj), you have to
configure the option to force load the calabash-framework. The reason that we have to do
this for calabash-ios is because the calabash server runs as part of the app itself(rather than
in android the instrumentation server will run on a seperate app). And its better you
configure this in Debug configuration so that release builds does not have this.
configure the option to force load the calabash-framework. The reason that we have to do
this for calabash-ios is because the calabash server runs as part of the app itself(rather than
in android the instrumentation server will run on a seperate app). And its better you
configure this in Debug configuration so that release builds does not have this.
In the Additional mtouch arguments, configure
-gcc_flags "-framework CFNetwork -framework CoreGraphics -force_load $(ProjectDir)/calabash.framework/calabash -lstdc++"
3. Now when you run the app on the Iphone simulator, the test server would be started and you can confirm this from the following entry in the output window
2013-07-13 14:21:39.100 FieldServiceiOS[13911:23803] Bonjour Service Published: domain(local.) type(_http._tcp.) name(Calabash Server)
Optionally you can confirm that the server is working by running any query(say query("button") in the calabash-ios console from the Terminal. You would be able to see an output like this
My-MacBook-Pro:Myapp.iOS Me$ calabash-ios console
Running irb...
irb(main):001:0> query("button")
[
[0] {
"class" => "UIButton",
"rect" => {
"center_x" => 158,
"y" => 376,
"width" => 150,
"x" => 83,
"center_y" => 401.5,
"height" => 51
},
"frame" => {
"y" => 358,
"width" => 150,
"x" => 125,
"height" => 51
},
"UIType" => "UIControl",
"description" => "<UIButton: 0x163cce70; frame = (125 358; 150 51); opaque = NO; autoresize = LM+RM+BM; layer = <CALayer: 0x163cb7d0>>"
}
]
irb(main):003:0>
Can you distribute the .zip of the calabash folder that worked for you since the most recent one doesn't?
ReplyDeleteBetter, use this command "calabash-ios download" to get the framework rather than the zip file. This is the right way to use it. I thought I updated this on the post. I will do so.
ReplyDeleteI followed their guide, but I get stuck at "calabash-ios setup" because it doesn't find an .xcodeproj file in my project (which is normal since we use Xamarin.iOS).
ReplyDeleteYes, that needs Xcode. But if you are using Xamarin, you can follow this blog but except for the zip you can use the calabash-ios download command to get the framework. It should work
ReplyDeleteI just tried and it works as suggested. Thank you very much!
ReplyDeleteThank you!
ReplyDeleteXamarin is the best language for the mobile app development process and developers are free to develop anything in Swift, Java and Objective-C. Xamarin apps use innate UIs on any platform to empower the best possible capabilities and experiences.
ReplyDeleteI followed all the steps but after the Bonjour Service Published I get loading errors. Do you know why could it be? Thank you!
ReplyDeletehttp://pbrd.co/11Qi6Ki
It is not working for me Native linking error: file not found: /calabash.framework/calabash
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteDetected Xamarin project, but did not detect built app linked with Calabash
ReplyDeleteYou should build your project from Xamarin Studio
Make sure you build for Simulator and that you're using the Calabash components (RuntimeError)
Rebuild all in debug - save all - and try again
ReplyDeletethe only guide that worked for me. Thanks
ReplyDelete