The document discusses automated user interface testing on iOS. It explains that UI testing tests the user-facing elements of an app rather than internal implementations. Automated UI testing using Instruments and UIAutomation makes testing less boring by automating repetitive tasks. Tests are written in JavaScript and interact with UI elements by simulating user interactions like taps and swipes. Elements are identified using accessibility labels and the element hierarchy. The document provides examples of finding and interacting with elements and includes screenshots in test results.
4. UI Testing
Why?
If we’re testing internals we should probably test
externals
2
5. UI Testing
Why?
If we’re testing internals we should probably test
externals
It’s what the user sees, and that’s more important
than how it does whatever
2
6. UI Testing
Why?
If we’re testing internals we should probably test
externals
It’s what the user sees, and that’s more important
than how it does whatever
Why not?
2
7. UI Testing
Why?
If we’re testing internals we should probably test
externals
It’s what the user sees, and that’s more important
than how it does whatever
Why not?
It’s bloody boring the 37th time
2
11. Automated testing
Much less boring
Gives you confidence that your users’ experiences will
be as planned
Hard to forget to test something
3
12. Automated testing
Much less boring
Gives you confidence that your users’ experiences will
be as planned
Hard to forget to test something
Much less likely to have to issue an emergency update
3
13. Automated testing
Much less boring
Gives you confidence that your users’ experiences will
be as planned
Hard to forget to test something
Much less likely to have to issue an emergency update
Gives you an excuse to read xkcd comics
3
16. How to do it
AUIT is part of Instruments
Tests are written in JavaScript
4
17. How to do it
AUIT is part of Instruments
Tests are written in JavaScript
AUIT uses the accessibility interfaces
4
18. How to do it
AUIT is part of Instruments
Tests are written in JavaScript
AUIT uses the accessibility interfaces
Make your app accessible and you’re half-way there
4
21. How does it do it
Your app has a DOM which is accessible using
JavaScript
6
22. How does it do it
Your app has a DOM which is accessible using
JavaScript
The accessibilityLabel property of a UIView is the key
6
23. How does it do it
Your app has a DOM which is accessible using
JavaScript
The accessibilityLabel property of a UIView is the key
The automation instrument can simulate nearly all user
interactions
6
24. How does it do it
Your app has a DOM which is accessible using
JavaScript
The accessibilityLabel property of a UIView is the key
The automation instrument can simulate nearly all user
interactions
Works with both the simulator and real device
6
27. accessibilityLabel
Using Xcode it’s available in the Utilities panel (third
screen)
Not all controls have it available in Xcode
7
28. accessibilityLabel
Using Xcode it’s available in the Utilities panel (third
screen)
Not all controls have it available in Xcode
e.g. UIBarButtonItem
7
29. accessibilityLabel
Using Xcode it’s available in the Utilities panel (third
screen)
Not all controls have it available in Xcode
e.g. UIBarButtonItem
Available in code for all UIViews
7
30. accessibilityLabel
Using Xcode it’s available in the Utilities panel (third
screen)
Not all controls have it available in Xcode
e.g. UIBarButtonItem
Available in code for all UIViews
setAccessibilityLabel:(NSString*)label
7
31. accessibilityLabel
Using Xcode it’s available in the Utilities panel (third
screen)
Not all controls have it available in Xcode
e.g. UIBarButtonItem
Available in code for all UIViews
setAccessibilityLabel:(NSString*)label
setIsAccessibilityElement:(BOOL)value
7
71. Output
Instruments will output a .plist file with the log
XSL to make a nice looking report
http://blog.essencework.com/post/1728269540/xcode-uiautomation-for-test-
result-report-part-2
Add the xsl processing to the .plist xml
<?xml-stylesheet href="Formatter.xsl" type="text/xsl"?>
Open in a browser
27
75. Conclusion
UIAutomation is another tool to ensure robust software
It takes the pain away from routine UI testing
Gets you started on adding accessibility to apps
28
76. Conclusion
UIAutomation is another tool to ensure robust software
It takes the pain away from routine UI testing
Gets you started on adding accessibility to apps
A good way to do demos and videos
28