/calabash-ios

Calabash for iOS

Primary LanguageRubyOtherNOASSERTION

master develop versioning license contributing
Build Status Build Status GitHub version License Contributing

Calabash iOS

http://calaba.sh/

Calabash is an automated testing technology for Android and iOS native and hybrid applications.

Calabash is a free-to-use open source project that is developed and maintained by Xamarin.

While Calabash is completely free, Xamarin provides a number of commercial services centered around Calabash and quality assurance for mobile, namely Xamarin Test Cloud consisting of hosted test-execution environments which let you execute Calabash tests on a large number of Android and iOS devices. For more information about the Xamarin Test Cloud visit http://xamarin.com/test-cloud.

Requirements

Xamarin Studio users should visit http://developer.xamarin.com/testcloud/ for setup instructions and requirements.

We recommend that you use the most recent released version of Xcode, MacOS, and Ruby.

  • MacOS 10.10 or 10.11
  • Xcode 6 or 7
  • iOS Devices >= 7.1
  • iOS Simulators >= 8.0
  • ruby >= 2.0 (latest is preferred)

For the best Ruby experience we recommend that you use a managed Ruby like rbenv or rvm).

If you are just getting started or don't want to commit to a managed Ruby, we recommend you install and use the Calabash Sandbox.

# Installs the Calabash Sandbox
$ curl -sSL https://raw.githubusercontent.com/calabash/install/master/install-osx.sh | bash

Please do not install gems with sudo

For more information about ruby on MacOS, see these Wiki pages:

IMPORTANT

Calabash uses private APIs to inspect your app's view hierarchy. Apps that inlcude the Calabash iOS Server will be rejected if they are submitted to the AppStore. The tutorials below describe a number ways to add Calabash to your Xcode project that will ensure you do not accidently submit a binary that will be reject because it includes Calabash.

Getting Started

If you want to see Calabash iOS in action, head over to the Calabash iOS Smoke Test App and follow the instructions in the README. We use this app to document, demonstrate, and test Calabash iOS. You can use this app to explore Calabash and as an example for how to configure your Xcode project and Calabash workflow.

The examples below assume you are using a managed ruby or are working in the Calabash Sandbox:

$ calabash-sandbox
This terminal is now ready to use with Calabash.
To exit, type 'exit'.

Step 1: Link calabash.framework

To start using Calabash in your project, you need to link an Objective-C framework (calabash.framework) to your application. These instructions are compatible with apps that are written in Swift.

Tutorial Description
Debug Config Use linker flags in the Debug build config to load the calabash.framework
Calabash Config Create a new Calabash Build Configuration
-cal Target Add a new app target to Xcode.

If you want to get started quickly, follow the Debug Config instructions. The Tutorial: How to add Calabash to Xcode wiki page discusses the merits of each approach and has instructions for using CocoaPods.

Step 2: Run Cucumber against an iOS Simulator

The Calabash iOS Example README has simple instructions for how to link the calabash.framwork, generate a features directory, run cucumber, and and open a Calabash console.

# In the directory where your .xcodeproj and Gemfile are
$ bundle exec calabash-ios gen

Build and run in Xcode, targeting an iOS Simulator. Calabash will try to detect the .app you just built.

$ bundle exec cucumber

If Calabash cannot find the .app you just built, it will raise an error. If this happens, you will to tell Calabash where it can find your .app.

By default, Xcode builds to a DerivedData directory:

~/Library/Developer/Xcode/DerivedData/<UDID>/Build/Products/Debug-iphonesimulator/<NAME>.app

Try to locate the .app and set the APP variable:

$ export APP="~/Library/Developer/Xcode/DerivedData/<UDID>/Build/Products/Debug-iphonesimulator/<NAME>.app"
$ bundle exec cucumber

We recommend using scripts and/or changing the location where Xcode stages build products. The sample projects use scripts to stage binaries to a ./Products, even when building from Xcode. You can use the Xcode > Preferences > Locations settings to do the same.

Where to go from here?

Topic Description
Getting Started A more in-depth tutorial using the LPSimpleExample.
Testing on Physical Devices Everything you need to know about testing on physical devices.
API Docs The Calabash iOS ruby API
iOS Smoke Test App Demonstrates advanced features, setups, and workflows
iOS WebView Test App Demonstrates how to interact with UIWebView and WKWebView
Getting Help The Calabash iOS Wiki

Links

License

Copyright (c) LessPainful APS. All rights reserved.
The use and distribution terms for this software are covered by the
Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
which can be found in the file epl-v10.html at the root of this distribution.
By using this software in any fashion, you are agreeing to be bound by
the terms of this license. You must not remove this notice, or any other,
from this software.