UIAutomation scripts that use jasmine + some helper scripts to make instruments reporting failure (useful for Continuous Integration)
Ruby Objective-C JavaScript Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
HelloWorld.xcodeproj
HelloWorld
Helpers
Hudson
JasmineStyleUIAutomationTests
UnitTests
.gitignore
.gitmodules
README

README

****************************************** Update *****************************************************
Tested with newest Xcode Version 4.3.2 (4E2002).
Last modification of this document: 27-04-2012.
*******************************************************************************************************

This is an example project (HelloWorld) accompanied by two UIAutomation tests written in the jasmine BDD style.
In order to run the tests you need to point UIAutomation instrument at the suite.js file from the JasmineStyleUIAutomationTests folder.
You should see two passing tests in the log. By default I use the iPhone target. iPad device should work as well, but it is not tested at the moment.
What else can you find in this project. There are two helper scripts, that you can use as a learning material for preparing acceptance tests to be integrated with Continuous Integration system.
As you probably know, UIAutomation Instrument can be invoked from the command line, but it returns SUCCESS even if there is a failing tests. In the Helpers folder you will find some help. There are two scripts: execute_acceptance_tests.rb is a top level script which 1) runs instruments and 2) it invokes another helper script parse_automation_log.rb in order to find out failing records. If at least one failing record is found it will make the top-level script to return error code 1 meaning FAILURE. For the convenience it also prints each failed case to the standard output. The scripts are Cucumber and RSpec tested so it should be easy to understand how they work and what they are doing just by looking at features and specs. As usually, there is still space for improvement, but I hope this is a reasonable starting starting point for ATDD with iOS. In the Hudson folder you will find an archive with a iOS ATDD job for Hudson. Just unpack this file to your jobs directory in your HUDSON_HOME directory and then simply restart Hudson server. A new job iOS ATDD should appear in the list of Hudson jobs. With it you should have a complete picture of how everything fits together.

Pivotal (https://github.com/pivotal/jasmine-iphone) is the original author of all the scripts from 
the JasmineStyleUIAutomationTests folder. I only modified them and I added HelloWorld-spec.js (containing the specs) for the demonstration.
Jasmine is included as a submodule so do not forget to do:

git submodule update --init
 
I could not make the original pivotal code working with Xcode 4.2 DP 3. 
I observed that the import functionality in UIAutomation instrument does not meet pivotal expectations.
Therefore I've changed slightly their files. I tested it with Xcode 4.2 DP 2 and 3.

The newest version of jasmine introduces 'exports'. It seems that UIAutomation instrument does not like that. 
To fix the problem I declare the 'window' variable in jasmine-uiautomation.js. 
Without it, Jasmine thinks that 'window' is 'undefined' and do will use 'exports'.