Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Automated Browser Testing with Selenium and PHPUnit

Automated Browser Testing with Selenium and PHPUnit

As the technical co-founder of a startup faced with the challenge of delivering a secure, scalable, cross-browser payments platform with virtually no QA resources, I turned to Selenium and PHPUnit to fully automate end-to-end browser based testing. After introducing Selenium and PHPUnit, I'll demonstrate how easy it is to get started, highlight lessons learned over the past 4 years of using Selenium, and discuss the latest tools/trends from the Selenium community. Regardless of your company size, Selenium is a surefire way to improve your QA and testing process with minimal investment.

12ab843bf4b1533e3d7897721e583dfd?s=128

Joshua Silver

October 16, 2015
Tweet

Transcript

  1. Automated  Browser  Testing  with   Selenium  (and  PHPUnit) Joshua  Silver

    VP,  Product  Development  &  co-­‐founder Patientco
  2. ¡ Background ¡ Testing  at  Patientco ¡ Introduction  to  Selenium

    ¡ How  it  works  /  Getting  started ¡ Testing  in  the  cloud ¡ Next  Steps
  3. ¡ Patientco  helps  healthcare  providers  improve  all   aspects  of

     patient  financial  engagement ¡ Billing,  payments,  healthcare  integrations ¡ Founded  in  2009 ¡ We’re  hiring! ¡ www.PatientcoLife.com
  4. ¡ Background: § CompSci from  GT § Helped  internationalize  CareerBuilder.com

    platform ¡ Technical  co-­‐founder  of  Patientco ¡ Fun  Fact:     § Travel  junkie:  25  countries  by  the  time  I  was  25
  5. Develop  a  robust  payments  platform ….  that’s  cross  browser  compliant

    ….  that  ALWAYS  works ….  with  a  small  development  team ….  and  no  resources  for  QA
  6. ¡ Payment  processing § Heavy  client  side  logic § Lots

     of  hairy  javascript ¡ Healthcare § COMPLEX  business  rules § Wide  variability  in  data ¡ Browsers
  7. Hospital  Usage Patient  Usage

  8. ¡ Manual  QA

  9. ¡ Manual  QA

  10. ¡ Manual  QA ¡ Automated  testing § Unit  Testing §

    Integration  Testing § Full-­‐blown  front  end  testing
  11. ¡ All  critical  areas  of  the  site  (payment  processing,  

    registration,  etc.)    are  under  full  Selenium  test   coverage ¡ 2000+  tests ¡ 10,000s  of  distinct  test  cases (Most  tests  utilize  dataProviders to  test  various   cases  with  the  same  code) ¡ Run  end-­‐to-­‐end,  takes  many  hours.
  12. Percent  Lines  of  Code Test  Code Application   Code

  13. None
  14. ¡ Selenium  helps  you  automate  browser   based  tests  (with

     recent  support  for  mobile) ¡ Write  one  test  and  run  in  all  browsers ¡ Script  complex  user  interactions,  including   AJAX,  dynamic  elements,  file  uploads,  etc. ¡ Invoked  through  PHPUnit tests
  15. None
  16. None
  17. ¡ Selenium  1  – Remote  Control  (RC) § Javascript layer

     on  top  of  browser § Largely  procedural § DEPRECATED! ¡ Selenium  2  – WebDriver § Native/direct  calls  to  browser § Largely  OO § Allows  for  complex  interactions
  18. None
  19. None
  20. None
  21. None
  22. None
  23. None
  24. None
  25. 1. Start  with  SeleniumBuilder https://saucelabs.com/builder 2. Export  test  results 3.

    Tweak  in  code: 1. Refactor  common  helper  functions 2. Add  dataProviders 3. Increase  number  of  asserts,  etc.
  26. ¡ Huge  array  of  testing  Browser/OS  platforms ¡ Manual  test

     sessions ¡ Video  and  Screenshots ¡ Mobile  testing
  27. None
  28. None
  29. None
  30. ¡ Start  small.  Test  something,  anything. ¡ Testing  should  never

     be  a  separate  ticket.  It’s   a  STEP  in  a  development  ticket. ¡ Keep  an  eye  on  long  running  tests  and  try  to   consolidate  tests.   ¡ Track  which  areas  of  the  application  are   tested.
  31. ¡ Official  docs: § http://www.seleniumhq.org/docs/ ¡ Testing  in  the  cloud:

    § https://saucelabs.com § https://www.browserstack.com/ ¡ Go  test  something!
  32. ¡ With  Selenium,  you  can  automate  practically   anything! ¡

    Selenium  provides  all  of  the  basic  building   blocks: § “Clicking”,  “typing”,  “dragging” § Capturing  data  elements § Conditional  logic  through  test  driver
  33. http://xkcd.com/576/

  34. Joshua  Silver joshua.silver@patientco.com www.PatientcoLife.com

  35. None