Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Upcoming SlideShare
Underscore.js
Underscore.js
Loading in …3
×
1 of 83

Automated ui testing

5

Share

Download to read offline

The

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Automated ui testing

  1. 1. Automated User Interface Testing Working while you’re at lunch David Reidy uTeach 1
  2. 2. UI Testing 2
  3. 3. UI Testing Why? 2
  4. 4. UI Testing Why? If we’re testing internals we should probably test externals 2
  5. 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. 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. 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
  8. 8. Automated testing 3
  9. 9. Automated testing Much less boring 3
  10. 10. Automated testing Much less boring Gives you confidence that your users’ experiences will be as planned 3
  11. 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. 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. 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
  14. 14. How to do it 4
  15. 15. How to do it AUIT is part of Instruments 4
  16. 16. How to do it AUIT is part of Instruments Tests are written in JavaScript 4
  17. 17. How to do it AUIT is part of Instruments Tests are written in JavaScript AUIT uses the accessibility interfaces 4
  18. 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
  19. 19. Demo Test 1 Yes, I know my coding style doesn’t match anyone else’s 5
  20. 20. How does it do it 6
  21. 21. How does it do it Your app has a DOM which is accessible using JavaScript 6
  22. 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. 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. 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
  25. 25. accessibilityLabel 7
  26. 26. accessibilityLabel Using Xcode it’s available in the Utilities panel (third screen) 7
  27. 27. accessibilityLabel Using Xcode it’s available in the Utilities panel (third screen) Not all controls have it available in Xcode 7
  28. 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. 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. 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. 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
  32. 32. Accessibility 8
  33. 33. Elements 9
  34. 34. Elements UIATarget.localTarget() 9
  35. 35. Elements UIATarget.localTarget() frontMostApp() 9
  36. 36. Elements UIATarget.localTarget() frontMostApp() mainWindow() 10
  37. 37. Elements UIATarget.localTarget() frontMostApp() mainWindow() tableViews()[0] 11
  38. 38. Elements UIATarget.localTarget() frontMostApp() mainWindow() tableViews()[0] cells()[5] 12
  39. 39. Elements UIATarget.localTarget() frontMostApp() mainWindow() tableViews()[0] cells()[5] elements()[“Name”] 13
  40. 40. You are where? 14
  41. 41. You are where? UIATarget.localTarget().logElementTree() 14
  42. 42. You are where? UIATarget.localTarget().logElementTree() The UIAutomation equivalent of Google Maps 14
  43. 43. Demo logElementTree() 15
  44. 44. 16
  45. 45. UIATarget.localTarget() 17
  46. 46. UIATarget.localTarget().frontMostApp() 18
  47. 47. UIATarget.localTarget().frontMostApp().mainWindow() 19
  48. 48. UIATarget.localTarget().frontMostApp().mainWindow().navig ationBar() 20
  49. 49. UIATarget.localTarget().frontMostApp().mainWindow().navig ationBar().buttons() 21
  50. 50. UIATarget.localTarget().frontMostApp().mainWindow().navig ationBar().buttons()[“Send”] 22
  51. 51. Interactions - Taps 23
  52. 52. Interactions - Taps element.tap() 23
  53. 53. Interactions - Taps element.tap() element.tapWithOptions() 23
  54. 54. Interactions - Taps element.tap() element.tapWithOptions() number of taps 23
  55. 55. Interactions - Taps element.tap() element.tapWithOptions() number of taps number of fingers 23
  56. 56. Interactions - Taps element.tap() element.tapWithOptions() number of taps number of fingers length of tap 23
  57. 57. Interactions - Taps element.tap() element.tapWithOptions() number of taps number of fingers length of tap offset of tap 23
  58. 58. Interactions - More taps 24
  59. 59. Interactions - More taps touchAndHold() 24
  60. 60. Interactions - More taps touchAndHold() doubleTap() 24
  61. 61. Interactions - More taps touchAndHold() doubleTap() twoFingerTap() 24
  62. 62. Interactions - Others 25
  63. 63. Interactions - Others dragInsideWithOptions() 25
  64. 64. Interactions - Others dragInsideWithOptions() flickInsideWithOptions() 25
  65. 65. Interactions - Others dragInsideWithOptions() flickInsideWithOptions() scrollToVisible() 25
  66. 66. Screenshots 26
  67. 67. Screenshots captureScreenWithName() 26
  68. 68. Screenshots captureScreenWithName() Does what it says 26
  69. 69. Screenshots captureScreenWithName() Does what it says Doesn’t work with the simulator (currently) 26
  70. 70. Screenshots captureScreenWithName() Does what it says Doesn’t work with the simulator (currently) I usually include them with a failed assert 26
  71. 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
  72. 72. Conclusion 28
  73. 73. Conclusion UIAutomation is another tool to ensure robust software 28
  74. 74. Conclusion UIAutomation is another tool to ensure robust software It takes the pain away from routine UI testing 28
  75. 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. 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
  77. 77. Resources 29
  78. 78. Resources WWDC 2010 Videos - Session 306 29
  79. 79. Resources WWDC 2010 Videos - Session 306 UI Automation Reference Collection 29
  80. 80. Resources WWDC 2010 Videos - Session 306 UI Automation Reference Collection http://developer.apple.com/library/ios/#documentation/DeveloperTools/ Reference/UIAutomationRef/Introduction/Introduction.html 29
  81. 81. Resources WWDC 2010 Videos - Session 306 UI Automation Reference Collection http://developer.apple.com/library/ios/#documentation/DeveloperTools/ Reference/UIAutomationRef/Introduction/Introduction.html Alex Vollmer’s blog (3 July 2010) 29
  82. 82. Resources WWDC 2010 Videos - Session 306 UI Automation Reference Collection http://developer.apple.com/library/ios/#documentation/DeveloperTools/ Reference/UIAutomationRef/Introduction/Introduction.html Alex Vollmer’s blog (3 July 2010) http://alexvollmer.com/posts/2010/07/03/working-with-uiautomation/ 29
  83. 83. Resources WWDC 2010 Videos - Session 306 UI Automation Reference Collection http://developer.apple.com/library/ios/#documentation/DeveloperTools/ Reference/UIAutomationRef/Introduction/Introduction.html Alex Vollmer’s blog (3 July 2010) http://alexvollmer.com/posts/2010/07/03/working-with-uiautomation/ dcr@afiyf.com.au, @reidyd 29

Editor's Notes

  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • ×