[mac] automation testing technical sharing - 2013 dec
TRANSCRIPT
Chloe Chen - 測試開發部�
ATOMac – GUI Automated Tes3ng on Mac
• About Me • Automa+on Tes+ng • ATOMac • System Environment & Tools • Usage • Demo • Q & A
Outline
陳芝媛 Chloe Chen� • 經歷� • ECS - software engineer� • KKBOX - SDET�
• 聯絡我� • FB: chloe.chen.727� • gmail: chloechen727 �
About Me
• 個性� • 人來瘋� • 喜歡小孩�
About Me
• 個性� • 人來瘋� • 喜歡小孩�
• About Me • Automa+on Tes+ng • ATOMac • System Environment & Tools • Usage • Demo • Q & A
Outline
• Defini+on: – 利用程式、工具取代人工進行的測試活動�
Automation Testing
Maria, � 幫我測試 1 加個 一萬次,� 看有沒有問題,結果正不正確。�
收到。(開始按計算機…)�
(…+1+1+1…)�
Maria, 測好了嗎?�
(…+1+…) 還沒。�
快點測好。�
…………………�
� � � � � 忘記剛剛算到哪了啦……�
• Defini+on: – 利用程式、工具取代人工進行的測試活動�
• 按你千、萬遍也不厭倦、不中斷�
• Pros: " Stability – tested by program " Cost Saving
" Regression Test " Stress Test " Performance Test
Automation Testing
• About Me • Automa+on Tes+ng • ATOMac • System Environment & Tools • Usage • Demo • Q & A
Outline
• Short for Automated Tes+ng on Mac • The first Python GUI tes+ng library • Tes+ng Mac app via.
• Easy to use to write tests.
ATOMac
• OS X (10.6, 10.7, 10.8, 10.9) • Install Python, Xcode • Enable Systemwide accessibility System Preferences > Universal Access > Enable access for assis+ve devices. • Install ATOMac – sudo easy_install atomac
• Op+on: iPython, sublime Text 2
System Environment & Tools
Systemwide accessibility
• Use ATOMac to launch an applica+on
• Get a reference to the UI Element in app
• Find object in the accessibility hierarchy – Xcode à Open Developer Tools à Accessibility Inspector
– To fix the target element : fn + command + F7
• Search method
• Control object
Usage
• Get the App bundle ID & App Localized Name – 活動監視器 à Almighty Calculator à 取樣程序
– Process: Almighty Calculator
– Iden+fier: com.ktpd.Calculator
Usage
• Use ATOMac to launch an applica+on – Import atomac
– atomac.launchAppByBundleId('com.ktpd.Calculator')
• Get a reference to the UI Element in app – calculator = atomac.getAppRefByLocalizedName('Almighty Calculator')
• Find object in the accessibility hierarchy – window = calculator.windows()[0]
Usage
Usage
• Search method • For most types of accessibility objects
– sheet = calculator.window.sheets()[0]
• For UI elements • FindFirst / FindFirstR • FindAll / FindAllR – sheet = calculator.window.sheets()[0] – equal_bugon = calculator.findFirstR(AXRole='AXBugon', AXTitle='=')
Usage
• Control object • Get Agribute
– equal_bugon.getAgribues()
• Get Ac+ons – equal_bugon.getAc+ons()
• Trigger the ac+on – equal_bugon.Press()
Usage
• Demo with ‘Almighty Calculator’
Demo
Q & A
• Python Automated Tes+ng on Mac: hgp://pyatom.com/ • Source at Github: hgps://github.com/pyatom/pyatom
References
We need you! Welcome to KKBOX!
THANK YOU!