Running UIAutomation tests from Command Line

Posted in Apple, iOS, QA, Testing by AltF on February 5, 2012

Continuous Integration (CI) implements continuous processes of applying quality assurance. In the App development world, we can achieve this by automating the build and release with includes automatic trigger of smoke/functional tests and automatic deployment.

I’ve covered how to write UIAutomation tests in my previous posts (here and here) and also how to distribute stable build over the air (here). You can run your tests from command line and configure a hudson job to always deploy stable build automagically. You can run your tests from CLI using the following command.

$ instruments -t templateFilePath targetAppName

By default the tests will be executed on the simulator, you could execute the tests on actual device using the following command:

$ instruments -w deviceID -t templateFilePath targetAppName

You could execute any instruments template using command line, for example to trigger a UIAutomation template from command line you would use the command as follows:

$ instruments -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate <path-to-your-app>/<appname>.app/ -e UIASCRIPT <path-to-your-js-test-file> -e UIARESULTSPATH <path-to-results-folder>

This is really helpful in terms of achieving CI compliance, I’ve basically written a py script that does the following:

– create a new tag from svn trunk with minor release version update
– grab the tag from svn
– complile the app from command line for xocde
– run the uiautomation smoke tests from command line (mentioned above)
– if tests are green, publish the build on the web server for OTA test distribution.
– repeat for new release


UIAutomation on iPad

Posted in Apple, mobile, QA by AltF on November 17, 2010

UIAutomation is only available in iOS 4.0+ SDK – so to run UIAutomation on the iPad make sure your application is compiled to run on 4.x simulator/device. You will need to download the latest version of the SDK to get the 4.x version of the iPad Simulator (also you can upgrade your device firmware to 4.x to run on the device). Download the latest version of the SDK from Apple Dev Center.

Refer to my previous post “Automating iOS User Interface Testing with UIAutomation” for getting started with UIAutomation.

For those of you who are still getting the error like “Automation is not available for this version of the iPhone Simulator.” when trying to run UIAutomation on iPad Simulator – please check the following things:

1. Ensure that you build your application for the correct version of iOS SDK. Select iOS 4.x as Base SDK in the project info before building.

2. Also ensure that the Instruments is running the application on the correct version of iPad Simulator. Select your application in the “Choose Target” and select the correct version of iPad Simulator under “Launch Options” (by default it’s selected to iPad Simulator 3.2, change that to iPad – Simulator – iOS 4.x)

Once you have selected iOS 4.x in Instruments – you should be able to run your UIAutomation scripts on the iPad Simulator.

%d bloggers like this: