[mac] automation testing technical sharing - 2013 dec

26
Chloe Chen - 測試開發部 ATOMac – GUI Automated Tes3ng on Mac

Upload: chloe-chen

Post on 20-Mar-2017

294 views

Category:

Software


4 download

TRANSCRIPT

Page 1: [Mac] automation testing  technical sharing - 2013 dec

Chloe Chen - 測試開發部�

ATOMac  –  GUI  Automated  Tes3ng  on  Mac    

Page 2: [Mac] automation testing  technical sharing - 2013 dec

•  About  Me  •  Automa+on  Tes+ng  •  ATOMac  •  System  Environment  &  Tools  •  Usage  •  Demo  •  Q  &  A  

Outline

Page 3: [Mac] automation testing  technical sharing - 2013 dec

陳芝媛 Chloe Chen� •  經歷� •  ECS - software engineer� •  KKBOX - SDET�

•  聯絡我� •  FB: chloe.chen.727� •  gmail: chloechen727 �

About Me

•  個性� • 人來瘋� • 喜歡小孩�

Page 4: [Mac] automation testing  technical sharing - 2013 dec

About Me

•  個性� • 人來瘋� • 喜歡小孩�

Page 5: [Mac] automation testing  technical sharing - 2013 dec

•  About  Me  •  Automa+on  Tes+ng  •  ATOMac  •  System  Environment  &  Tools  •  Usage  •  Demo  •  Q  &  A  

Outline

Page 6: [Mac] automation testing  technical sharing - 2013 dec

•  Defini+on:  –  利用程式、工具取代人工進行的測試活動�

Automation Testing

Page 7: [Mac] automation testing  technical sharing - 2013 dec

Maria, � 幫我測試 1 加個 一萬次,� 看有沒有問題,結果正不正確。�

收到。(開始按計算機…)�

Page 8: [Mac] automation testing  technical sharing - 2013 dec

(…+1+1+1…)�

Maria, 測好了嗎?�

(…+1+…) 還沒。�

快點測好。�

Page 9: [Mac] automation testing  technical sharing - 2013 dec

…………………�

Page 10: [Mac] automation testing  technical sharing - 2013 dec

� � � � � 忘記剛剛算到哪了啦……�

Page 11: [Mac] automation testing  technical sharing - 2013 dec

•  Defini+on:  –  利用程式、工具取代人工進行的測試活動�

•  按你千、萬遍也不厭倦、不中斷�

•  Pros:  "  Stability  –  tested  by  program  "  Cost  Saving  

"   Regression  Test  "   Stress  Test  "   Performance  Test  

Automation Testing

Page 12: [Mac] automation testing  technical sharing - 2013 dec

•  About  Me  •  Automa+on  Tes+ng  •  ATOMac  •  System  Environment  &  Tools  •  Usage  •  Demo  •  Q  &  A  

Outline

Page 13: [Mac] automation testing  technical sharing - 2013 dec

•  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

Page 14: [Mac] automation testing  technical sharing - 2013 dec

•  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

Page 15: [Mac] automation testing  technical sharing - 2013 dec

Systemwide accessibility

Page 16: [Mac] automation testing  technical sharing - 2013 dec

•  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

Page 17: [Mac] automation testing  technical sharing - 2013 dec

•  Get  the  App  bundle  ID  &  App  Localized  Name  –  活動監視器 à  Almighty  Calculator  à  取樣程序  

– Process:                  Almighty  Calculator  

– Iden+fier:            com.ktpd.Calculator  

Usage

Page 18: [Mac] automation testing  technical sharing - 2013 dec

•  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

Page 19: [Mac] automation testing  technical sharing - 2013 dec

Usage

Page 20: [Mac] automation testing  technical sharing - 2013 dec

•  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

Page 21: [Mac] automation testing  technical sharing - 2013 dec

•  Control  object  •  Get  Agribute  

– equal_bugon.getAgribues()  

•  Get  Ac+ons  –   equal_bugon.getAc+ons()  

•  Trigger  the  ac+on  –   equal_bugon.Press()  

Usage

Page 22: [Mac] automation testing  technical sharing - 2013 dec

•  Demo  with  ‘Almighty  Calculator’    

Demo

Page 23: [Mac] automation testing  technical sharing - 2013 dec

Q & A

Page 24: [Mac] automation testing  technical sharing - 2013 dec

•  Python  Automated  Tes+ng  on  Mac:    hgp://pyatom.com/  •  Source  at  Github:  hgps://github.com/pyatom/pyatom  

References

Page 25: [Mac] automation testing  technical sharing - 2013 dec

We need you! Welcome to KKBOX!

Page 26: [Mac] automation testing  technical sharing - 2013 dec

THANK YOU!