The Long Weekend Website

iOS application unit tests from the command line: Xcode 4.5 update

By Mark on November 11th, 2012
Tags: , , ,

We receive a decent amount of traffic from a post I wrote 18 months ago in which we described how to trick Xcode 4.x into running your application unit tests from the command line.

Unfortunately, as of Xcode 4.5, this trick appears to be broken. You’ll get this error message when you run your tests:

Unknown Device Type. Using UIUserInterfaceIdiomPad based on screen size
Terminating since there is no workspace.

(For more details, see this StackOverflow post regarding Xcode 4.5 command line unit testing.)

Worse yet, if you’re like us and using command line unit testing in a CI (=Jenkins) environment, you probably didn’t even notice the failure at first, because the xcodebuild command doesn’t fail — it completes successfully despite not running any of your tests (!).

Luckily, a gentleman named Scott Thompson on StackOverflow had found a way a few months prior (even to Xcode 4.5) to use ios-sim to launch the iOS simulator with some arguments and environment variables to tell the simulator to running application unit tests, much in the way Xcode magically does when you press Command-U in the IDE.

The solution involves creating a new scheme for your tests, and then using a post-build script to run ios-sim with the right flags. There’s no point to reproduce the solution here, as the SO answer is well-written and clear:

http://stackoverflow.com/questions/5403991/xcode-4-run-tests-from-the-command-line-xcodebuild/10823483#10823483

Best of luck, and thanks Scott and Pawel!


Great Mobile UX: Slideshare Presentation of the Day


In addition to being a Long Weekender, I work for a great company in Tokyo called Moneytree. Last weekend I gave [...]

Posted In Technobabble
August 7th, 2012

Reading Chinese on your iPhone Just Got Easier


Reading Chinese on your iPhone Just Got Easier Makers of popular language study applications Rikai Browser and Chinese Flash release [...]

Posted In Products
April 4th, 2012

Learn iOS Complete – Teaching Series


In partnership with Swinburne University of Technology in 2011 we ran a variety of courses teaching software development for the [...]

Posted In Technobabble
March 18th, 2012

Rikai Browser 1.5 Released


Rikai Browser, the easy way to read Japanese websites on your iPhone & iPad, has just been updated. In this [...]

Posted In Products
March 2nd, 2012

Juliette Review on Geek Mom


We recently launched Juliette & The Shiny Red Ballon, our first iPad children’s book. As we pointed out, it also [...]

Posted In Products
February 26th, 2012

Our First Storybook Helps Kids with Cancer


Long Weekend  and the Tyler Foundation recently announced the release of Juliette and the Shiny Red Balloon, a bedtime storybook for iPad presented in English [...]

Posted In Weekendology
February 2nd, 2012

New iPad Storybook Supports Families of Children with Cancer


TOKYO – The Tyler Foundation, a charity supporting children with cancer and their families, has a new venue for fundraising: [...]

Posted In Products
February 1st, 2012

Should we add this to Japanese & Chinese Flash?


We consider Japanese Flash and Chinese Flash to be pretty mature products: most of the code has been developed over [...]

Posted In Products
January 19th, 2012

New iOS App Chinese Flash Combines Vocab Study, Tone Practice


TOKYO – Jan 9, 2012 – Chinese Flash, a new tool for studying Chinese vocabulary, launched today on the Apple [...]

Posted In Products
January 9th, 2012

20MB Limit: Finding the Real Size of an App Binary


In our language learning products Japanese Flash & Chinese Flash, we have quite large sql files. This puts us over [...]

Posted In Technobabble
December 21st, 2011

older posts >