MarkChang-測試開發部 �
iOSUIAutomation
• Introduction– UIAutomationtesting
• iOSAccessibility
• DevelopmentTools– Environment– Instruments– TuneupJSLibrary
• Q&A
Outline
• Somesoftwaretestingis…– Boring– Routine
• Soweneedanautomationtestingtool!
UIAutomationtesting
1. User'sview– Forblindusers.
2. Engineer'sview– ForUIAutomationtesting.– Maybeshowsinsideinformationofsystem.
iOSAccessibility
• > > >VoiceOver
iOSAccessibility
• Setelementaccessibility
• Setelementtraits
iOSAccessibilityiniOScode
Identityinspector
Demo
• Hardware– Mac– iDevice(iPhone,iPad,iPod)
• Software– Xcode(version5.1)– SublimeText2(optional)
Developmentenvironment
• Instrumentsisaperformance,analysis,andtestingtoolfordynamicallytracingandprofilingOSXandiOScode.
Instruments
• Automation– Performautomatedtestsonrealdevicesandon
iPhoneSimulator.
– StrongrelationshipbetweenAccessibilityandUIAutomation.
– JavaScriptlanguage.
Instruments
Instruments
UIButton
UIButton
• Clickonthescreen
• Clickabutton
Instruments
accessibilityLabel
• UIALogger– logMessage():Logsthespecifiedmessage.
– logPass():Logsamessageandindicatesatesthascompletedsuccessfully.
– logFail():Logsamessageandindicatesatesthascompletedunsuccessfully.
Instruments
• ItimprovestheUIAutomationlibraryprovidedbyApplefortestingiOSapplicationsviaInstruments.
• JavaScriptlanguage.
TuneupJSLibrary
• testfunctionintest.js• assertfunctionsinassertions.js
• Example:
TuneupJSLibrary
assertEqualsfunction�
• Ifyouwanttoautomateyourscripts,youcanlaunchthemfromthecommandline.
TuneupJSLibrary
example�
command�
• UsingTheBuilt-inTestRunner.
TuneupJSLibrary
command�
example�
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%
• 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
Q&A
ThankYou