• Save
 'Automated Web Testing: Traps for the Unwary' by Simon stewart
Upcoming SlideShare
Loading in...5
×
 

'Automated Web Testing: Traps for the Unwary' by Simon stewart

on

  • 1,224 views

If you want stable automated web tests that don't consume all your time to maintain there are three areas that you need to master: using locators properly, synchronisation and waiting, and basic ...

If you want stable automated web tests that don't consume all your time to maintain there are three areas that you need to master: using locators properly, synchronisation and waiting, and basic Object Orientation. This talk helps explain why honing your technical skills will allow you to become more effective, and shows how these three areas are handled when using WebDriver. We'll be covering topics such as when to use CSS locators to find elements and when to use XPath, through the difference between implicit and explicit waiting and why they matter, through to the Page Object pattern and how to apply it maintainably.

www.eurostarconferences.com

Statistics

Views

Total Views
1,224
Views on SlideShare
1,224
Embed Views
0

Actions

Likes
1
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • There are other mechanisms (such as link text), but we’ll not be paying attention to them for now.Note that although ids should be unique they very seldom are.
  • Three main reasons. it can be very brittle as the tools used to create them automatically tie the expression very closely to the page: it won’t survive a refactoring.Xpath engines work at different speeds. On IE there isn’t one available for an HTML DOM, so we use one written in JS, but JS on IE is slower than on any other browserDifferent browsers interpret HTML differently. The page structure may well be different in different browsers
  • Best way to find a parent node (“..”)Can be a useful way of narrowing down a subset of the DOM (eg: finding all TR elements when there are nested tables)
  • Whereas Xpath tends to only be used by testers, CSS selectors are often shared with UX and/or designers. They are less brittleSelectors located by machine tend to be far less brittle
  • What if you’re using JQuery?Also a really good way to implement “Gray Box” testing: have the app provide useful JS functions to grab bits of the UI. Gmonkey in Gmail provides access to key parts of the UI in this way.
  • Demo implmentation
  • Watch out for the StaleElementReferenceException

'Automated Web Testing: Traps for the Unwary' by Simon stewart Presentation Transcript

  • 1. Automated Web Testing: Traps forthe UnwarySimon Stewart, Selenium ProjectSimon is best known as the lead of the Seleniumproject and is the creator of the WebDriver APIs. Hehas been the Tech Lead of Google’s BrowserInfrastructure team and has previously worked atThoughtWorks.He loves code.www.eurostarconferences.com
  • 2. Join the conversation on Twitter#esconfs@esconfs@shs96cwww.eurostarconferences.comContinue the conversation with the speaker on Twitter after the show!
  • 3. The Three Things You Need to Know• How to find things• How to wait for things• How to keep your codecleanhttp://www.flickr.com/photos/hfiguiere/4802869688/
  • 4. FINDING THINGS
  • 5. How to Find Things• Find by– id– name– css selector– xpathhttp://www.flickr.com/photos/icesabre/2142494372/
  • 6. Why XPath is a Bad Ideahttp://www.flickr.com/photos/38194075@N05/4430503343/
  • 7. And Why It’s Nothttp://www.flickr.com/photos/robives/7134916437/
  • 8. Why CSS Locators are Preferable• Shared with design andUX• Less brittlehttp://www.flickr.com/photos/ervega/3662623495/
  • 9. Using Javascript to Locate Elementshttp://www.flickr.com/photos/biker_jun/4138642796/
  • 10. Custom Bys• ARIA• JQuery
  • 11. WAITING
  • 12. How a Web App Communicates Witha Server
  • 13. Other Causes for Delays• Native events• window.setTimeout• Local JS processing• WebWorkers
  • 14. Implicit Waiting
  • 15. Explicit Waits
  • 16. Wait<X>, FluentWait<X>, WebDriverWait
  • 17. Expected Conditions
  • 18. Writing New Expected Conditions• Extend « ExpectedCondition »• Can be as complex as you like
  • 19. CLEAN CODE
  • 20. The DRY Principlehttp://www.flickr.com/photos/remibridot/2218573670/
  • 21. Page Objects: Applying OO and DRYto Test Code• Reflect services offeredto users• Are the only place withdeep knowledge ofpage structure• Can be composedhttp://www.flickr.com/photos/dandiffendale/7891256336/
  • 22. PageFactory
  • 23. LoadableComponent
  • 24. SlowLoadableComponent
  • 25. There Are Other Ways• Narrative-basedframeworks• Scenarios and Steps inBDD• Custom DSLshttp://www.flickr.com/photos/dolmansaxlil/6779097439/
  • 26. www.eurostarconferences.comQuestions?
  • 27. EuroSTAR Webinar ArchiveAccess almost 50 on-demand software testing webinars by the worlds leadingtesting experts. Topics include….www.eurostarconferences.comAgile, Automation, Test Management, Process Improvements, Risk-based Testing, PerformanceTesting, Test Documentation, Cloud Testing, Session-based Testing, Weekend TestersVisit the archive!http://www.eurostarconferences.com/community/member/webinar-archive@esconfs#esconfs
  • 28. The EuroSTAR Community.Are you a member?Did you know we have an online resource area with almost …www.eurostarconferences.com600 software testing presentations, 50 topicalwebinars, over 40 videos and podcasts and 20 experteBooksDo you know that membership is completely free and you can access thesepremium testing resources anytime?Join today!http://www.eurostarconferences.com/community/member@esconfs#esconfs
  • 29. Call for Submissions to speak at the 2013 EuroSTARConference is now open!Speak at Europe’s #1 Software Testing EventTheme: Questioning Testing Deadline for submissions February 13thFor more information http://www.eurostarconferences.com/speakers/conference-2013-call-for-submissions