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

Automated Browser Testing with Selenium and PHP...

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.

Joshua Silver

October 16, 2015
Tweet

More Decks by Joshua Silver

Other Decks in Technology

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. ¡ Manual  QA ¡ Automated  testing § Unit  Testing §

    Integration  Testing § Full-­‐blown  front  end  testing
  8. ¡ 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.
  9. ¡ 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
  10. ¡ 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
  11. 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.
  12. ¡ Huge  array  of  testing  Browser/OS  platforms ¡ Manual  test

     sessions ¡ Video  and  Screenshots ¡ Mobile  testing
  13. ¡ 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.
  14. ¡ Official  docs: § http://www.seleniumhq.org/docs/ ¡ Testing  in  the  cloud:

    § https://saucelabs.com § https://www.browserstack.com/ ¡ Go  test  something!
  15. ¡ 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