awesome test automation made simple w/ dave haeffner
Post on 09-Jan-2017
1.781 Views
Preview:
TRANSCRIPT
Awesome Test Automation
Made Simpleby Dave Haeffner
Agenda
1. Getting Started with Powerful Tests
2. Running Your Tests on any Browser
3. Automating Your Test Runs with CI
4. Q&A
Act I Getting Started
+
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
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
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
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
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
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
Finding Quality Locators
• Inspect the page
• Verify your selection
• e.g., FirePath or FireFinder
• http://bit.ly/verifyinglocators
Common Selenium actions• find_element
• click
• clear
• send_keys
• text
• displayed?
Look up your language’s bindings http://bit.ly/seleniumwiki
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
An Example (with Ruby & RSpec)
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
Act 2 Any Browser
with
+
An Example
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
Act 3 Automated Test Runs
with and
+
Continuous Integration
• Feedback loops
• Code promotion
Feedback loops• The goal: Find failures early and often
• Notifications
• Email, chat, SMS
• In-person (audio & visual)
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
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
An Example
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
Awesome Test Automation has been Achieved!
Q&A Panel
Adam Carmi Co-founder & VP of R&D
Abhijit Pendyal Solutions Engineer, Sauce Labs
Brian Dawson DevOps Evangelist, CloudBees
Free Stuff!
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
top related