Your SlideShare is downloading. ×
Dov'è il tasto ok?
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Dov'è il tasto ok?

727
views

Published on

Introduction to functional test with selenium rc, selenium ide and phpunit integration

Introduction to functional test with selenium rc, selenium ide and phpunit integration

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
727
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Dov'è il tasto Ok??? Michele Orselli
  • 2. Who am I Michele Orselli – Developer @Ideato – Email: mo@ideato.it – Twitter: _orso_
  • 3. This site is broken! Credits: http://thedailywtf.com/
  • 4. This site is broken! Credits: http://thedailywtf.com/
  • 5. This site is broken! Credits: http://thedailywtf.com/
  • 6. Testing and You How do you ensure software quality? – Testing? – QA?
  • 7. Testing Triangle Credits: http://patrickwilsonwelsh.com/?p=32
  • 8. Functional Tests • Check a feature from the user's point of view – Great for QA • Pros & Cons • Not a substitute for unit test
  • 9. Selenium Remote Control – Java Based – Open Source IDE – Firefox extension – Record and Playback
  • 10. Where to use it • Acceptance Test • Bug Report • Performance • Cross-browser compatibility
  • 11. Selenium RC Architecture Credits: http://seleniumhq.org/
  • 12. Getting Started Download – http://selenium.googlecode.com/files/selenium-remote-control-1.0.3.zip Unzip Java -jar selenium-server.jar – Options: • port • timeout • log • HtmlSuite • -h show all available options
  • 13. Selenium API Browser-independent API – Same test run on several os/browser Bindings for several languages Base API: – Assert* – Verify* – WaitFor*
  • 14. A first test (Selenese) open /web/listaeventi.php assertTextPresen t Faccio cose vedo gente Plain HTML Table: ... ... ...
  • 15. A first test (PHPUnit)
  • 16. Where's the OK button? (1)
  • 17. Where's the Ok button? (2)
  • 18. Where's the Ok button? (3)
  • 19. Finding Elements Identifing elements: – identifier=id: @id/@name – id=id: Select the element with the specified @id attribute. – name=name: Select the first element with the specified @name attribute. – dom=function foo() { return document.links[1]; }; foo(); – link=textPattern http://release.seleniumhq.org/selenium-remote/control/0.9.2/doc/dotnet/Selenium.html
  • 20. Finding Elements String-match Patterns – glob:pattern: • "*": any sequence of characters • "?": any single character. • Glob patterns match against the entire string. – regexp:regexp: match a string using a regular-expression. – exact:string: match a string exactly
  • 21. Finding Elements (2) Resolving strategies: – dom, for locators starting with "document." – xpath, for locators starting with "//" – identifier, otherwise
  • 22. Css Selectors • all css1, css2 and css3 selectors (except namespaces in css3) – css=a[href="#id3"] – css=span#firstChild + span pseudo classes – :nth-of-type, :nth-last-of-type, :first-of-type, :last-of-type – :visited, :hover, :active, :focus • pseudo elements – ::first-line,::first-letter, ::selection, ::before, ::after • examples: – div#id, div.class, div > p > a – a[href=”http://www.google.com”]
  • 23. Xpath Selectors Level Separator: / Every Level: // Wildcard: * Attribute: @ Wildcard @* Examples: – xpath=//img[@alt='The image alt text'] – xpath=//table[@id='table1']//tr[4]/td[2] – xpath=//a[contains(@href,'#id1')]
  • 24. Demo
  • 25. Limitation Test are sloooooooow – Reuse browser session – Test are not indipendent Expressiveness – Build your own DSL on top of selenium
  • 26. Beyond Selenium Get rid of the browser! – Framework-dependent approaches (eg: symfony) – Generic, curl-style based • https://github.com/enygma/frisk • PHPUnitWebBrowser • everzet.com/behat
  • 27. Demo
  • 28. We're done! Q&A
  • 29. Thank you! Email: mo@ideato.it Twitter: _orso_ Please rate my talk! – http://joind.in/2120