---
title: "Zucchini: iOS Testing Written in Ruby & CoffeeScript"
url: https://deallocatedobjects.com/posts/zucchini-visual-ios-testing-written-in-coffeescript
author: Jake Marsh
published: 2011-12-23
updated: 2013-11-16
link: http://www.zucchiniframework.org/
topics: ["Xcode & Tools", "Open Source"]
description: "Zucchini is an awesome cucumber-like visual testing framework for iOS. It works in a pretty awesome way by compiling CoffeeScript down to UIAutomation-compliant Javascript, and then running the test with Instruments.app’s command-line tool."
---

# Zucchini: iOS Testing Written in Ruby & CoffeeScript

By Jake Marsh, December 23, 2011. HTML: https://deallocatedobjects.com/posts/zucchini-visual-ios-testing-written-in-coffeescript

This is a link post about http://www.zucchiniframework.org/

[Zucchini](https://web.archive.org/web/20120107231845/http://www.zucchiniframework.org/) is an awesome [cucumber](https://web.archive.org/web/20120101212428/http://cukes.info/)-like visual testing framework for iOS. It works in a pretty awesome way by compiling [CoffeeScript](http://coffeescript.org/) down to [UIAutomation](https://web.archive.org/web/20120102170531/http://developer.apple.com/library/ios/documentation/DeveloperTools/Reference/UIAutomationRef/_index.html)-compliant Javascript, and then running the test with Instruments.app's command-line tool.

Also, As their site describes further, the whole system works very much like [Cucumber](https://web.archive.org/web/20120101212428/http://cukes.info/), the popular ruby/rails testing gem:

> A Zucchini feature file consists of sections bound to contexts of different application screens. Every screen you proceed to needs to be backed up by a CoffeeScript class describing all UI elements you want Zucchini to interact with as well as custom actions you feel like performing on that screen.

Here's an example of one such class:

``` coffeescript

class PostScreen extends Screen
  anchor: -> view.navigationBars()["Post"]
  
  constructor: ->
    super 'post'
    
    extend @elements,
    'Post': -> view.navigationBars()["Post"].buttons()["Post"]
    
    extend @actions,
    'Type "([^"]*)"$': (text) ->
      messageArea = view.elements()['Message Text Area']
      messageArea.setValue text

```

Zucchini has an impressive set of features including:

* Using a natural language for interaction scenarios, such as `Then on the "Menu" screen:`, etc.
* The ability test/compare against screenshots.
* Integration with Jenkins for full-on regression testing.

> Zucchini only runs on Mac OS X 10.6 and 10.7 and requires XCode 4.2 as well as Ruby (at least 1.8.7).

[The Zucchini site](https://web.archive.org/web/20120107231845/http://www.zucchiniframework.org/) is full of really helpful links and installation instructions, so check it out, you can also find [the Zucchini project on Github here](https://github.com/playup/zucchini).
