Questions tagged [ios-ui-automation]

Automated UI Testing using the Automation instrument included with Instruments for iOS development. Not to be confused with [xcode-ui-testing] which was introduced in Xcode 7.

Instruments is an application shipped with Xcode and used to help profile applications in both iOS and OS X development. One of the tools included with Instruments is the UIAutomation instrument which allows for automated testing of user interfaces using scripts written in JavaScript. This functionality was introduced with the iOS 4 SDK.

This tag specifically focuses on using this functionality in relation to iOS development. These scripts can be used not only to automate a user's interaction with the application, but they can also contain asserts which can test if the application is behaving according to the developer's expectations.

For the new Xcode 7 UI Testing feature, see .

756 questions
7
votes
2 answers

UIAutomation with code coverage

I am currently automating our iOS testing on jenkins. So far I had no problems with running unit tests, converting OCUnit into JUnit and generating code coverage in Cobertura format (lots of googling but no hard problems). However, when creating…
Sulthan
  • 128,090
  • 22
  • 218
  • 270
7
votes
3 answers

Resetting iOS simulator between tests

I have a set of automated test cases set up in instruments using tuneup.js to test an app. I decided to use tuneup.js as it allowed me to separate my tests into individual test cases and run the whole set from one individual script, this works fine…
ChrisH
  • 285
  • 3
  • 13
7
votes
3 answers

How to continue testing an iOS app, using UIAutomation instrument, even after the app exits?

I have an app. There is a button in the app, which, if clicked, exits the app. I am testing the app using UIAutomation instruments. I want to test this button. But after the app exits, the instrument stops giving an exception. What I want to do is…
7
votes
2 answers

Unable to get UIAutomation iOS UILabel value

I am trying to get the value "HELLO" of the UILabel shown in the iPad simulator. I have enabled accessibility and have set the label as "Label Access". But when I call target.logElementTree(), both the name and value are set to "LabelAccess" and as…
i_raqz
  • 2,919
  • 10
  • 51
  • 87
7
votes
3 answers

Running iOS UIAutomation tests from Jenkins

For a while now I've been trying to work out how to run UIAutomation tests from Jenkins - every time I run the build, it builds fine, then it runs my instruments command (using the same command as detailed here ( Can Instruments be used using the…
ChrisH
  • 285
  • 3
  • 13
6
votes
2 answers

Have CoffeeScript output a line as raw javascript?

Is there a way to tell CoffeeScript to just ignore a certain line and output it as is? I want this line to be included in the resulting javascript #import './blah/blah' But CoffeeScript is compiling it as a comment so it ends up as //import…
Christian Schlensker
  • 21,708
  • 19
  • 73
  • 121
6
votes
1 answer

UIAutomation Scripts examples

Does anyone found any examples on UIAutomation test scripts with sample projects? So far I found only WWDC2010 video covering the topic, but no sample scripts/projects to play around with. Also is there any way to achieve code…
Michał Zygar
  • 4,052
  • 1
  • 23
  • 36
6
votes
1 answer

iOS UIAutomation : Accessing custom subviews added on a UIScrollView in automation script

I am very new to the iOS UIAutomation, here is the problem I am facing I have a view hierarchy as below and want to access CustomView2 elements in the automation sctipt UIWindow > UIScrollView > CustomView1 (Multiple) > CustomView2 (Multiple) The…
Ziya
  • 81
  • 1
  • 6
6
votes
1 answer

Within a script in the UI Automation instrument, how do I import another script?

Within a script written in JavaScript for the UI Automation instrument, how do I import another JavaScript file?
6
votes
2 answers

Unable to tap (x,y) coordinate in landscape mode

In Xcode 8 / Swift 3, using the coordinate(withNormalizedOffset: CGVector) function to interact with an XCUIElement appears to work only in portrait mode. To test this functionality, I created a single screen project with a button centered in the…
tedrothrock
  • 368
  • 2
  • 9
6
votes
2 answers

Programmatically turn on/off wifi on real iOS device with UI Automation

I have already read once or twice that turn on/off wifi on a real iOS device (iPad in my case) with a UI Automation script seems not possible. I've also read that you can create a script with the target "Settings" but it seems that it's only for…
DarkRainbow
  • 97
  • 1
  • 5
6
votes
2 answers

How can I verify the name of a label in a table view using Instruments on iOS?

I'm using the Xcode "Instruments" tool to build automation for an iOS application and I need to verify that the label for an entry I've created in my app is correct. The code listed below is, for some reason, not resulting in a solid pass or fail.…
Wulf
  • 379
  • 1
  • 6
  • 16
6
votes
2 answers

iOS Instruments Automation "setValue" not working

I just want to test my iOS UI with UI Automation but I got stuck when it comes to enter text into UITextFields. The documentation says that the method "setValue(...)" should do the trick but it doesn't. I always get this error: Script threw an…
ralphbert
  • 123
  • 2
  • 8
6
votes
2 answers

How to reset Instruments after Automation Instrument rejected command

(Xcode 4.5) When running instruments from the command line it works the first time but then it won't run again until after I reboot. The verbose output from Instruments includes this: Instruments : Loading template…
jhabbott
  • 18,461
  • 9
  • 58
  • 95
5
votes
1 answer

Debugging UIAutomation scripts in Instruments

I have recently tried using UIAutomation framework for some simple automated UI tests for iOS devices. While interesting and relatively powerful, I find it quite tedious to write the scripts without having the possibility of debugging them. Is there…
Tomas Vana
  • 18,317
  • 9
  • 53
  • 64