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.
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. 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. 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. 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. 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. 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. Finding Quality Locators
• Inspect the page
• Verify your selection
• e.g., FirePath or FireFinder
• http://bit.ly/verifyinglocators
11. Common Selenium actions
• find_element
• click
• clear
• send_keys
• text
• displayed?
Look up your language’s bindings
http://bit.ly/seleniumwiki
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
18. 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
22. 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
28. 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
30. 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
35. 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