Cross Browser Testing with Selenium

210a2116d2266c84d155f1d8a14f31ef?s=47 FEVR
December 18, 2014

Cross Browser Testing with Selenium

How to use selenium web driver for testing websites on different browser and different devices

210a2116d2266c84d155f1d8a14f31ef?s=128

FEVR

December 18, 2014
Tweet

Transcript

  1. CROSS BROWSER TESTING WITH SELENIUM MARCO PICELLO marco.picello.dev@gmail.com

  2. WHO AM I Marco Picello J2EE consultant Automation lover

  3. AGENDA What is Selenium webdriver Good parts Bad parts Q&A

  4. TODAY FUNCTIONAL TEST OF WEB APP Multiple browser Multiple display

    dimensions (a.k.a. Responsive design) Mobile app Time consuming Error prone Booring!!!!
  5. BENEFITS OF AUTOMATIC FUNCTIONAL TESTING OF WEB APPLICATION Frequent regression

    testing Rapid feedback to developers Form of documentation for test cases, automatically generated, and up to date Custom defect reporting Finding defect missing by manual testing
  6. SELENIUM Created by Thoughworks in 2007 Now opensource Set of

    components for automated testing Custom defect reporting Used by Thoughworks, Facebook, Google, and many others
  7. SELENIUM COMPONENTS Selenium IDE Selenium WebDriver Selenium Grid

  8. OK, SO WHAT CAN I DO WITH WEBDRIVER? Open a

    web page in a real browser Change browser dimensions Interact with browser: click on link, upload file, fill input field, click on checkbox, etc Take web page's screenshots Get the page source
  9. SELENIUM WEBDRIVER OVERVIEW

  10. JSON WIRE PROTOCOL

  11. SUPPORTED BROWSERS Internet Explorer 6, 7, 8, 9, 10 FireFox

    Safari Opera HtmlUnit phantomjs Android (with Selendroid or appium) iOS (with ios-driver or appium)
  12. SELENIUM WEBDRIVER CLIENT, DEVELOPED OFFICIALLY Java C# Ruby Python Javascript

    (Node)
  13. SELENIUM WEBDRIVER CLIENT, DEVELOPED NOT OFFICIALLY PHP Perl Objective-C R

    Dart TCL Go
  14. HELLO WORLD SELENIUM // Create a new instance of the

    Firefox driver WebDriver driver = new FirefoxDriver(); // And now use this to visit Google driver.get("http://www.google.com"); // Find the text input element by its name WebElement element = driver.findElement(By.name("q")); // Enter something to search for element.sendKeys("Cheese!"); // Now submit the form. WebDriver will find the form for us from the element element.submit(); //Close the browser driver.quit();
  15. GOOD PARTS Mature project (current version is 2.44.0) Cross browser

    Language indipendent
  16. BAD PARTS!!! Tests are slow Flaky test It's just a

    driver!!! You'll write lots of boilerplate code
  17. TESTS ARE SLOW Parallelize: split long test in multiple small

    test Use the grid Luke!!!!!! Use the cloud Luke!!!!!! (https://saucelabs.com/)
  18. FLAKY TEST Facebook runs each test X times to check

    if a test is flaky
  19. IT'S JUST A DRIVER Missing out of the box functional

    testing solution Need to put several pieces together: testing framework (junit), report framework (NGReport)
  20. BOILERPLATE CODE Automatic Functional Tests != Automatic Generation of Functional

    Tests Developers need to write boilerplate code, lot's of boilerplate code!!!!!!! Use PageObjects
  21. SUGGESTION FOR A SAFE START Start small, stay small: write

    tests for the most often used case, or small case, then gradually add other tests Use Page Objects Automatic Page Object Generation, after each build
  22. IS IT REALLY WORTH?? THERE IS NO SILVER BULLET!!!!!!

  23. Q&A THANKS