ios uiautomation

20
Mark Chang - 測試開發部 iOS UIAutomation

Upload: jz-chang

Post on 14-Jan-2017

295 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: iOS UIAutomation

MarkChang-測試開發部 �

iOSUIAutomation

Page 2: iOS UIAutomation

•  Introduction–  UIAutomationtesting

•  iOSAccessibility

•  DevelopmentTools–  Environment–  Instruments–  TuneupJSLibrary

•  Q&A

Outline

Page 3: iOS UIAutomation

•  Somesoftwaretestingis…–  Boring–  Routine

•  Soweneedanautomationtestingtool!

UIAutomationtesting

Page 4: iOS UIAutomation

1.  User'sview–  Forblindusers.

2.  Engineer'sview–  ForUIAutomationtesting.–  Maybeshowsinsideinformationofsystem.

iOSAccessibility

Page 5: iOS UIAutomation

•  > > >VoiceOver

iOSAccessibility

Page 6: iOS UIAutomation

•  Setelementaccessibility

•  Setelementtraits

iOSAccessibilityiniOScode

Identityinspector

Demo

Page 7: iOS UIAutomation

•  Hardware–  Mac–  iDevice(iPhone,iPad,iPod)

•  Software–  Xcode(version5.1)–  SublimeText2(optional)

Developmentenvironment

Page 8: iOS UIAutomation

•  Instrumentsisaperformance,analysis,andtestingtoolfordynamicallytracingandprofilingOSXandiOScode.

Instruments

Page 9: iOS UIAutomation

•  Automation–  Performautomatedtestsonrealdevicesandon

iPhoneSimulator.

–  StrongrelationshipbetweenAccessibilityandUIAutomation.

–  JavaScriptlanguage.

Instruments

Page 10: iOS UIAutomation

Instruments

UIButton

UIButton

Page 11: iOS UIAutomation

•  Clickonthescreen

•  Clickabutton

Instruments

accessibilityLabel

Page 12: iOS UIAutomation

•  UIALogger–  logMessage():Logsthespecifiedmessage.

–  logPass():Logsamessageandindicatesatesthascompletedsuccessfully.

–  logFail():Logsamessageandindicatesatesthascompletedunsuccessfully.

Instruments

Page 13: iOS UIAutomation

•  ItimprovestheUIAutomationlibraryprovidedbyApplefortestingiOSapplicationsviaInstruments.

•  JavaScriptlanguage.

TuneupJSLibrary

Page 14: iOS UIAutomation

•  testfunctionintest.js•  assertfunctionsinassertions.js

•  Example:

TuneupJSLibrary

assertEqualsfunction�

Page 15: iOS UIAutomation

•  Ifyouwanttoautomateyourscripts,youcanlaunchthemfromthecommandline.

TuneupJSLibrary

example�

command�

Page 16: iOS UIAutomation

•  UsingTheBuilt-inTestRunner.

TuneupJSLibrary

command�

example�

Page 17: iOS UIAutomation

TestCaseAutomationRatio 測試案例類別� 自動化測試案例個數� 測試案例個數� 自動化比率�

01. 登入� 10 10 100.0%

02. 歌曲列表� 14 15 93.9%

03. 歌手\專輯 資訊頁面� 0 14 0%

04. 播放功能� 12 14 85.7%

05. 線上搜尋� 0 21 0%

06. 線上精選� 0 12 0%

07. 設定� 5 7 71.4%

08. 我的音樂庫� 0 8 0%

09. 一起聽� 0 10 0%

10. 一點聆� 46 46 100.0%

合計� 87 157 55.4%

Page 18: iOS UIAutomation

•  InstrumentsUserGuide:AboutInstruments–  https://developer.apple.com/library/mac/documentation/developertools

/conceptual/instrumentsuserguide/Introduction/Introduction.html

•  UIAutomationJavaScriptReference–  https://developer.apple.com/library/ios/documentation/DeveloperTools

/Reference/UIAutomationRef/_index.html

•  iOSAutomatedTestswithUIAutomation–  http://blog.manbolo.com/2012/04/08/ios-automated-tests-with-uiautomation

•  TuneupJS–  http://www.tuneupjs.org/–  https://github.com/alexvollmer/tuneup_js

Reference

Page 19: iOS UIAutomation

Q&A

Page 20: iOS UIAutomation

ThankYou