Getting started with Calabash on Xamarin Studio

Here’s a little setup guide to using Calabash with Xamarin Studio on Mac.

  • In a terminal, go to your Xamarin Studio Solution Directory
    • cd path-to-solution
  • Install calabash-cucumber gem (this make take some time because of dependencies)
    • gem install calabash-cucumber
    • (Note you may need to run sudo gem install calabash-cucumber if you get ERROR: While executing gem … (Gem::FilePermissionError)).
  • Setup your project for Calabash-iOS.
    • calabash-ios setup (Answer the questions and read the output 🙂
  • Generate a skeleton features folder for your tests
    • calabash-ios gen (this also copies the scripts irb_iosX.sh for “interactive development” into your current dir)
  • Download the Calabash-framework in the project directory(i.e the path where your .csproj
    file is present).

    • cd path-to-mainproject
    • calabash-ios download
    NOTE: you can also download manually from download from their framework downloads link
  • 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.
    In the Additional mtouch arguments, configure

    -gcc_flags “-framework CFNetwork -framework CoreGraphics -force_load $(ProjectDir)/calabash.framework/calabash -lstdc++”

     

  • Now from your solution directory you should be able to run the tests (if the features folder is present)
    The only way I’ve got it working is to prelaunch the app from Xamarin Studio and use the NO_LAUNCH command
    • cucumber NO_LAUNCH=1

Leave a Reply