22
Automated Tes,ng with Sikuli Emil Börjesson

Automated)Tes,ng)with)Sikuli) · 2012. 10. 24. · Sikuli) • GUIlevel)(image)recogni,on)) • Easy)to)learn,)easy)to)use) • Opensource) – Currently)atRC)2.) – Javaand)Python)source!)

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

  • Automated  Tes,ng  with  Sikuli  

    Emil  Börjesson  

  • System  

    Sub-‐System  1  

    Module  1  

    Tes,ng  

    •  Acceptance  Tests  •  System  tes,ng  •  Module  tes,ng  •  Unit  tes,ng  •  Free  tes,ng  •  And  so  on…  

    C2   CN  C1  

    Module  2  

    C2   CN  C1  

    Module  3  

    C2   CN  C1  

    Module  N  

    C2   CN  C1  

    Sub-‐System  N  

    Module  1  

    C2   CN  C1  

    Module  2  

    C2   CN  C1  

    Module  3  

    C2   CN  C1  

    Module  N  

    C2   CN  C1  

  • Automated  tes,ng  

    •  Unit  tes,ng  (JUnit)  – Low  level  –  Intrusive  – Language  dependent  

    •  GUI  object  tes,ng  (Selenium,  Abbot,  etc)  – Object  level  –  Intrusive  

  • Sikuli  

    •  GUI  level  (image  recogni,on)  •  Easy  to  learn,  easy  to  use  •  Open  source  – Currently  at  RC  2.  –  Java  and  Python  source!  

    •  Automated  System  tes,ng    – Regression  tes,ng  

    •  State  of  art!  

  • Sikuli  

    •  Download  Sikuli:  hXp://sikuli.org/download.shtml  

  • Install  Sikuli  

    •  Windows:  –  Install  the  .exe  file  

    •  Mac:  – Open  the  dmg  file,  move  icon  to  Applica,ons  

    •  Requires  that  you  have  Java  6!  – hXp://www.java.com/en/download/index.jsp  

  • Sikuli  IDE  (basic  code  constructs)  

  • Sikuli  IDE  (Images)  

  • Image  se_ngs  

    •  Click  on  an  image  in  the  script  to  modify  its  se_ngs  

  • Preferences  

  • Sikuli  IDE  (Regions)  

  • DEMO  

    •  YES!  It’s  movie  ,me!  ;)  

  • Sikuli  test-‐suites  

    •  Sikuli  is  state-‐of-‐the-‐art  

    •  Sikuli  does  not  have  support  for  test-‐suites!    –  SO!  We  made  our  own!  :P  

    •  Downloadable  from  the  course  webpage!  –  Includes:  

    •  testSuiteExecutor.sikuli  –  Main  script.  DON’T  TOUCH!  •  outPutWriter.sikuli  –  Output.  Touch  A  LOT!  •  tonA.sikuli  –  Helper  script  (Only  works  on  Android  1.5  HGVA  320x480)  •  tc0001.sikuli  –  Example  test  case  that  writes  Hello  World  in  browser  •  tc0002.sikuli  –  Template  test  case  

  • Sikuli  test-‐suites  

    •  Use  the  test-‐executor  script  •  Import  test  cases  into  the  test-‐executor  •  Test  cases  must  have  the  following  defini,ons:  – setUp()  –  tearDown()  –  runTest()  

    •  Link  to  download:  

  • Test-‐Suite  executor  Script  

  • Test  case  

  • Imports  

    •  In  file  imported  to:  

    •  In  imported  file  (Must  be  first  row!)  

  • Wri,ng  output  

    •  We  have  prepared  a  script-‐file  that  you  can  download  from  the  course  webpage.  (outPutWriter.sikuli)  –  IT  DOES  NOT  WORK!  :P  – Edit  defini,ons:  •  getOutWriter()  •  getAndroidSim()  •  closeAndSaveOutPutFile(group)  

    •  See  comments  in  code  for  help!  

  • outPutWriter.sikuli  (Changes)  

  • Issues  you  WILL  encounter!  

    •  TC  bug  correc,ons  are  not  recognized  by  the  Test-‐executor  script.  – Solu,on:  Restart  Sikuli  

    •  You  cannot  copy  paste  code  from  a  script  to  another!  Images  must  be  recaptured.  – Solu,on:  Import  or  recapture    

    •  There  is  no  collec,on  of  all  standard  Sikuli  script  func,ons.  – Solu,on:  Google!  “Sikuli  +”  

  • More  issues  you  WILL  encounter!  

    •  Sikuli  is  extremely  resolu,on  sensi,ve!  –  Solu,on:  Make  sure  you  all  have  the  same  screen  resolu,on!  

    •  Timing  is  oqen  a  problem  –  Solu,on:  add  wait  func,ons  when  needed.  

    •  Ex:  wait(3)  or  wait(“img3”,5)  

    •  The  image  recogni,on  is  some,mes  too  lenient.  –  Solu,on:  set  image  recogni,on  proper,es  to  higher  than  70%.  

  • Ques,ons?