awesome test automation made simple w/ dave haeffner
TRANSCRIPT
![Page 1: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/1.jpg)
Awesome Test Automation
Made Simpleby Dave Haeffner
![Page 2: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/2.jpg)
Agenda
1. Getting Started with Powerful Tests
2. Running Your Tests on any Browser
3. Automating Your Test Runs with CI
4. Q&A
![Page 3: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/3.jpg)
Act I Getting Started
+
![Page 4: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/4.jpg)
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
![Page 5: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/5.jpg)
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
![Page 6: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/6.jpg)
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
![Page 7: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/7.jpg)
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
![Page 8: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/8.jpg)
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
![Page 9: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/9.jpg)
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
![Page 10: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/10.jpg)
Finding Quality Locators
• Inspect the page
• Verify your selection
• e.g., FirePath or FireFinder
• http://bit.ly/verifyinglocators
![Page 11: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/11.jpg)
Common Selenium actions• find_element
• click
• clear
• send_keys
• text
• displayed?
Look up your language’s bindings http://bit.ly/seleniumwiki
![Page 12: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/12.jpg)
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
![Page 14: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/14.jpg)
An Example (with Ruby & RSpec)
![Page 15: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/15.jpg)
![Page 16: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/16.jpg)
![Page 17: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/17.jpg)
![Page 18: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/18.jpg)
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
![Page 19: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/19.jpg)
Act 2 Any Browser
with
+
![Page 20: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/20.jpg)
An Example
![Page 21: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/21.jpg)
![Page 22: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/22.jpg)
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
![Page 23: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/23.jpg)
Act 3 Automated Test Runs
with and
+
![Page 24: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/24.jpg)
![Page 25: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/25.jpg)
Continuous Integration
• Feedback loops
• Code promotion
![Page 26: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/26.jpg)
Feedback loops• The goal: Find failures early and often
• Notifications
• Email, chat, SMS
• In-person (audio & visual)
![Page 27: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/27.jpg)
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
![Page 28: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/28.jpg)
Simple Jenkins configuration1. 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
![Page 29: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/29.jpg)
An Example
![Page 30: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/30.jpg)
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
![Page 31: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/31.jpg)
Awesome Test Automation has been Achieved!
![Page 32: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/32.jpg)
Q&A Panel
![Page 33: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/33.jpg)
Adam Carmi Co-founder & VP of R&D
Abhijit Pendyal Solutions Engineer, Sauce Labs
Brian Dawson DevOps Evangelist, CloudBees
![Page 34: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/34.jpg)
Free Stuff!
![Page 35: Awesome Test Automation Made Simple w/ Dave Haeffner](https://reader033.vdocuments.site/reader033/viewer/2022042706/587271c41a28ab31498b6bb7/html5/thumbnails/35.jpg)
Automated Visual Testing e-Book: Step-by-Step Guide & Best Practices - by Dave Haeffner
Send an email to [email protected] 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