Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I improve iPhone UI Automation?

I was googling a lot in order to find a solution for my problems with UI Automation. I found a post that nice summarizes the issues:

There's no way to run tests from the command line.(...)

There's no way to set up or reset state. (...)

Part of the previous problem is that UI Automation has no concept of discrete tests. (...)

There's no way to programmatically retrieve the results of the test run. (...)

source: https://content.pivotal.io/blog/iphone-ui-automation-tests-a-decent-start

Problem no. 3 can be solved with jasmine (https://github.com/pivotal/jasmine-iphone)

How about other problems? Have there been any improvements introduced since that post (July 20, 2010)?

And one more problem: is it true that the only existing method for selecting a particular UI element is adding an accessibility label in the application source code?

like image 318
Maciek Sawicki Avatar asked Jan 24 '11 15:01

Maciek Sawicki


1 Answers

While UI Automation has improved since that post was made, the improvements that I've seen have all been related to reliability rather than new functionality.

He brings up good points about some of the issues with using UI Automation for more serious testing. If you read the comments later on, there's a significant amount of discussion about ways to address these issues.

The topic of running tests from the command line is discussed in this question, where a potential solution is hinted at in the Apple Developer Forums. I've not tried this myself.

You can export the results of a test after it is run, which you could parse offline.

Finally, in regards to your last question, you can address UI elements without assigning them an accessibility label. Many common UIKit controls are accessible by default, so you can already target them by name. Otherwise, you can pick out views from their location in the display hierarchy, like in the following example:

var tableView = mainWindow.tableViews()[0];

As always, if there's something missing from the UI Automation tool that is important to you, file an enhancement request so that it might find its way into the next version of the SDK.

like image 200
Brad Larson Avatar answered Oct 19 '22 17:10

Brad Larson