jump to navigation

UIAutomation – more help please 16 August 2010

Posted by David Wilson in iPhone.
2 comments

Not my usual post here.

I have been corresponding with Michael in Denmark over getting more cameras for that region loaded into TrafficCamNZ and also trying to resolve an issue that can cause the application to crash. The crash issue was rather difficult for me to reproduce. The good news is that I managed to get there in the end, find and fix the issue. I’ll make the submission to Apple for the new version shortly. In the mean time I watched WWDC 2010 Session 306 – Automating User Interface Testing With Instruments. This was quite inspirational and I though that I should be doing some of this automated testing.

Using the video from the WWDC session and slides was enough to get me started. It also had pointers to documentation. I quickly ran into issues trying to detect objects on the iPhone screen and was unable to determine when I should use .elements() and other things like .buttons(). And then some calls returned arrays of information making it difficult to get what I wanted. During the last few days I made several posts to the developer forums at Apple with requests for information and updates on my progress. I haven’t received much feedback but it is the US holiday season and this development work did occur over a weekend.

To help out other fellow developers I thought you would appreciate a post of some references and a copy of my script, which for the moment works with one exception. The exception is where I’m trying to detect the name of an onscreen alert. if you need this, you’ll see it in my code. And when it comes times to you needing it, I’ll either know what I’ve done wrong, or if it’s a but it will be fixed!

Enjoy, and please share your experiences.

Apple Documentation
http://developer.apple.com/iphone/library/documentation/DeveloperTools/Reference/UIAutomationRef/Introduction/Introduction.html
http://developer.apple.com/iphone/library/documentation/ToolsLanguages/Reference/UIATargetClassReference/UIATargetClass/UIATargetClass.html
http://developer.apple.com/iphone/library/documentation/ToolsLanguages/Reference/UIAElementClassReference/UIAElement/UIAElement.html

Other Web Articles
http://answers.oreilly.com/topic/1646-how-to-use-uiautomation-to-create-iphone-ui-tests/
http://alexvollmer.com/posts/2010/07/03/working-with-uiautomation/

JavaScript

testScript_01.js

Follow

Get every new post delivered to your Inbox.

Join 103 other followers