This is the first blog post in a series for getting Calabash-iOS up and running on a Mac with Yosemite.
Some Background...
I was recently asked to kick-start an iOS testing effort for a project here at work.Unfortunately, I'm not really a Mac person, nor had I used one in quite a while...let alone tested on one.
So what did I do? I immediately made several mistakes.
Mistake 1: Instruments
First, I tried out using Apple's built in tool for automated testing. While it's useful, it's not nearly as friendly as Calabash (thus the name of the post).Mistake 2: Forgetting others had done this
After asking around, I was reminded that we had another group do work on iOS, including automated tests!While it was a year or more back for most of the people who had worked with it, I found out through them about Calabash-iOS.
After digging into Calabash, I found it a more intuitive tool.
Basically, Calabash wraps Instruments, hiding some of the uglier parts, while providing some good functionality for testers to hook into.
Putting it all together:
I found an amazingly well-documented pair of blog posts (here and here) for installing everything you need to set up and run Calabash-ios through Ruby. I've copied out the relevant steps below.Installing RVM and Ruby
- Use CMD+SPACE to open up Spotlight (the equivalent to run in Windows)
- Search for Terminal (the Mac equivalent to command line)
- In terminal, run the following line
curl -L https://get.rvm.io | bash -s stable --auto-dotfiles --autolibs=enable --ruby
- Quit and relaunch terminal, then try the following commands:
type rvm | head -1
If all was installed correctly, the first command should return 'rvm is a function', and the other two should return their version numbers.rvm -v
ruby -v
Installing Cucumber and Calabash
- In Terminal, navigate to your project directory
- Run the following command to install calabash
- Once that is finished, run the following command to generate the files and folders calabash needs
- Open your project in xcode, and verify that you now have a duplicate of your scheme with a suffix of '-cal'
- In xcode, go to Targets > Build Phases > Link Binary
- Add "Security.framework" there
- Select the new -cal project, select a simulator, then run it.
- There may be a prompt to accept incoming network connections. Allow that if it displays.
- The following should appear in the console output. If so, everything is installed correctly:
gem install calabash-cucumber
calabash-ios gen
Creating the server: <LPHTTPServer: 0x8076530> Started LPHTTP server on port 37265 Bonjour Service Published: domain(local.) type(_http._tcp.) name(Calabash Server)
You should now have a fully-functional set of calabash tools to explore!
I'll make another post about actually writing Calabash tests, and getting them running.