Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Awesome Test Automation Made Simple w/ Dave Haeffner

2,028 views

Published on

Learn how to build simple and powerful automated tests that will work on the browsers you care about, cover visual testing and functional regressions, and be configured to run automatically through the use of a continuous integration (CI) server.

Published in: Engineering

Awesome Test Automation Made Simple w/ Dave Haeffner

  1. 1. Awesome Test Automation Made Simple by Dave Haeffner
  2. 2. Agenda 1. Getting Started with Powerful Tests 2. Running Your Tests on any Browser 3. Automating Your Test Runs with CI 4. Q&A
  3. 3. Act I Getting Started +
  4. 4. Selenium • Open-source browser automation tool • Every major browser, OS, and programming language • Mimics human action • Uses a few common actions • Works with “locators” Locators tell Selenium which HTML element a command refers to
  5. 5. Locator Strategies • Class • CSS selectors • ID • Link Text • Partial Link Text • Tag Name • XPath Good locators are: • unique • descriptive • unlikely to change That rules a few of these out
  6. 6. Locator Strategies • Class • CSS selectors • ID • Link Text • Partial Link Text • Tag Name • XPath Good locators are: • unique • descriptive • unlikely to change That rules a few of these out
  7. 7. Locator Strategies • Class • CSS selectors • ID • Link Text • Partial Link Text • Tag Name • XPath Good locators are: • unique • descriptive • unlikely to change That rules a few of these out Start with IDs and Classes
  8. 8. Locator Strategies • Class • CSS selectors • ID • Link Text • Partial Link Text • Tag Name • XPath Good locators are: • unique • descriptive • unlikely to change That rules a few of these out Start with IDs and Classes Use CSS or XPath sanely
  9. 9. Locator Strategies • Class • CSS selectors • ID • Link Text • Partial Link Text • Tag Name • XPath CSS vs XPath http://bit.ly/seleniumbenchmarks http://bit.ly/cssxpathexamples
  10. 10. Finding Quality Locators • Inspect the page • Verify your selection • e.g., FirePath or FireFinder • http://bit.ly/verifyinglocators
  11. 11. Common Selenium actions • find_element • click • clear • send_keys • text • displayed? Look up your language’s bindings http://bit.ly/seleniumwiki
  12. 12. A Login Example 1. Visit the login page 2. Find the login form’s username field and input text 3. Find the login form’s password field and input text 4. Find the submit button and click it
  13. 13. http://the-internet.herokuapp.com/login
  14. 14. An Example (with Ruby & RSpec)
  15. 15. Recap • Assertions are the crux of an automated test • Automated visual testing gives you hundreds of assertions in just a few lines of code • Automates something that used to be done manually • Over 16 open-source solutions available • Visual testing has limitations (e.g., false postives). Applitools handles them in stride http://bit.ly/se-visual-1
  16. 16. Act 2 Any Browser with +
  17. 17. An Example
  18. 18. Recap • Run Your Tests on any browser & operating system combination you need • Few lines of code • Great reporting (e.g., video recording) http://se.tips/cloud-testing
  19. 19. Act 3 Automated Test Runs with and +
  20. 20. Continuous Integration • Feedback loops • Code promotion
  21. 21. Feedback loops • The goal: Find failures early and often • Notifications • Email, chat, SMS • In-person (audio & visual)
  22. 22. Code Committed Integration (pass?) Deploy to autom. test server (success?) Run automated tests (pass?) Deploy to manual test server (manual) (success?) yes yes yes Notify team if no Code Promotion Bonus points: stop the line
  23. 23. Simple Jenkins configuration 1. Create a Job 2. Pull In Your Test Code 3. Set up Build Triggers 4. Configure Build steps 5. Configure Test Reports 6. Set up Notifications 7. Run Tests & View The Results
  24. 24. An Example
  25. 25. Recap • Automate Your Test Runs without infrastructure overhead • Plug into the development workflow you’re a part of • Enable notifications to fit your team’s context • Automatically link to high bandwidth information (e.g., Sauce Labs & Applitools job dashboards) to make everything sing http://se.tips/ci-walkthrough
  26. 26. Awesome Test Automation has been Achieved!
  27. 27. Q&A Panel
  28. 28. Adam Carmi Co-founder & VP of R&D Abhijit Pendyal Solutions Engineer, Sauce Labs Brian Dawson DevOps Evangelist, CloudBees
  29. 29. Free Stuff!
  30. 30. Automated Visual Testing e-Book: Step-by-Step Guide & Best Practices - by Dave Haeffner Send an email to info@applitools.com with EBOOK in the subject line 14 days FREE with killer features 8 VMs, 90 browser hours, unlimited manual sessions https://saucelabs.com/signup/trial Are you looking to transition from CI to CD? Download the e-book: "Making the Shift: From Continuous Integration to Continuous Delivery" http://bit.ly/cloudbees-ebook

×