Your SlideShare is downloading. ×

Advanced Selenium Workshop

4,032

Published on

The Advanced Selenium Workshop demonstrates how organizations and test teams succeed with Selenium and Open Source Test (OST) technology and methodology as a more affordable and flexible option to the …

The Advanced Selenium Workshop demonstrates how organizations and test teams succeed with Selenium and Open Source Test (OST) technology and methodology as a more affordable and flexible option to the proprietary test vendors. Watch how to:
Use Selenium in Java, Python, Ruby
Data enable Selenium scripts
Selenium target locators for Ajax applications
How To Work with TinyMCE (and other Ajax components) in Selenium
Writing Selenium-based Test Object Libraries

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,032
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
208
Comments
0
Likes
1
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. Advanced Selenium Workshop Frank Cohen, +01 (408) 871-0122, fcohen@pushtotest.com March 31, 2011
  • 2. Open Source Test Automation About PushToTest ‣Our Mission: We Test, For A More Reliable World ‣Make It Easier To Move From Manual To Automated Testing ‣Support Advanced Testing, including Agile, Load, Integration ‣Open Source Testing (OST) For Everyone 2
  • 3. Open Source Test Automation Agenda ‣Using Selenium in Java, Python, Ruby ‣Data enabling Selenium scripts ‣Selenium target locators for Ajax applications ‣How To Work with TinyMCE (and other Ajax components) in Selenium ‣Writing Selenium-based Test Object Libraries 3
  • 4. Open Source Test Automation Selenium Browser Automation 4 ‣Selenium Core ‣Selenium RC ‣Selenium Grid ‣Selenium IDE ‣Selenium Domain Specific Language (DSL)
  • 5. Open Source Test Automation What Is Selenium Missing? ‣Selenium Core and RC Require A Browser ‣Selenium IDE Record In Firefox Only, Coding Required To Be Useful, No Data Enablement ‣Selenium Grid for Functional Testing Only ‣No Reports or Results Analysis ‣No Cloud or Grid Deployment ‣No CI or QC Integration ‣RIA Testing using Ajax, Flex, Flash 5
  • 6. Open Source Test Automation Selenium Language Basics 6 ‣Page Commands ‣Element Commands ‣Validation Commands ‣Assertion Commands ‣Storage Commands
  • 7. Open Source Test Automation Selenium Locators ‣Identifiers ‣loginForm ‣id=loginForm ‣name=loginForm ‣XPath (1.0 from W3C, no support of 2.0 and XQuery) ‣Link Locator ‣link=Continue <a href=”mypage”>Continue</a> ‣DOM APIs ‣dom=document.getElementById('loginForm') ‣CSS Selectors ‣css=input.required[type="text"]7
  • 8. Open Source Test Automation Fun With XPath 8 ‣/html/body/table/tr/td/a -> //table/tr/td/a ‣//div[@id='manage_messages_iterator'] ‣<div id=”manage_messages_iterator”> blah </div> ‣//tr[@class=’SelectedRow’]/td[1] ‣<table><tr class=”SelectedRow”><td>me 1</td><td>me 2</td></ tr></table> ‣//td[child::text()=’myemail@me.com’] ‣<table><tr><td>myemail@me.com</td</tr></table> ‣//td[contains(child::text(),’@’)]
  • 9. Open Source Test Automation Miscellaneous ‣<a href=”continue.html”>Continue</a> ‣link=Continue ‣RFC 1738 example ‣ http://myusername:myuserpassword@myexample.com/blah/blah/blah 9
  • 10. Open Source Test Automation String Pattern Matches ‣glob:pattern ‣* represents any sequence of characters ‣? represents any single character ‣Matches against the entire string ‣regexp:regexp ‣Match a string using a regular-expression ‣Includes JavaScript regular-expressions ‣exact:string ‣Equals ‣No pattern prefix means use "glob" pattern 10
  • 11. Open Source Test Automation Event Handling and Ajax ‣Selenium Tests Are Event Oriented ‣Not Timing Oriented ‣Ajax Web Objects ‣Complicated Structures ‣Dynamic Values ‣Asynchronous Events ‣No Standards ‣Ajax Example 11
  • 12. Open Source Test Automation Fun With JavaScript ‣selenium.type("id", "frank"); ‣selenium.type(“id”, “javascript{ new Date().getTime();}”); ‣Class Persistence Within A Page 12 <tr> <td>assertEval</td> <td>myfunc = function ( myfile ) { alert(myfile); return 1 }; 1;</td> <td>1</td> </tr> <tr> <td>assertEval</td> <td>myfunc(&quot;frankolo&quot;)</td> <td>1</td> </tr>
  • 13. Open Source Test Automation Looping And Conditionals ‣Great For Ajax Asynchronous Events 13 <tr> <td>waitForCondition</td> <td>selenium.browserbot.getCurrentWindow().document. getElementById('login_button').disabled == false</td> <td>10000</td> </tr>
  • 14. Open Source Test Automation TinyMCE Editor API Access ‣http://tinymce.moxiecode.com/ 14 selenium.browserbot.getCurrentWindow(). document.tinyMCE.execCommand ('mceInsertContent',false,'<b>Hello world!!</b>');
  • 15. Open Source Test Automation Distributed Test Deployment 15 Application Under Test TestMaker Console TestNode Selenese Test Selenium RC SeleniumHtmlUnit Selenese Table Format Interpreter Selenium API
  • 16. Open Source Test Automation 16 Script Runners ScriptRunner Type Sahi Sahi Test Tool HAR HTTP Archive Designer Script Designer Script Selenium HtmlUnit Browser Selenium RC IE, Firefox, Chrome SoapUI SOAP and REST TestGen4Web Web 1.0 Tests Mozmill Mozilla XUL Tests Unit Tests jUnit TestCase DotNet .NET Tests Visual Basic VB tests Command Line Desktop and utils
  • 17. Open Source Test Automation Component Approach 17 Data Production Log-In Component setUp runTest tearDown ApplicationTestScenario Test Use Case Product Search Order Product Log-Out RDBMS DPL CSV DPL Custom DPL Load Test 100 Users 500 Users 1000 Users Log-In Component Component Development Database QA Regression Database Load Test Database Confirm Order Production Database
  • 18. Open Source Test Automation TestMaker Object Designer 18 ‣Point-and-Click Functional Test Record/Playback ‣Record Tests In IE, Chrome, Firefox, Safari, Opera ‣Automatic Ajax Synchronization ‣Drag-and-Drop Data Driven Testing ‣Creates Selenium, Sahi, and Flex Tests Demo
  • 19. Next let’s talk about Open Source Test Automation Performance Anxiety ‣The Perfect Storm: IE 7, Selenium, Appcelerator ‣Mitigation 19 Research Prepared By Luis Carlos Lara, llara@pushtotest.com William Martinez, william@pushtotest.com
  • 20. Open Source Test Automation The Problem 20 Ajax App, Selenium RC, TestMaker, Firefox 3 Ajax App, Selenium RC, TestMaker, Internet Explorer 7 30 s 30 m
  • 21. Open Source Test Automation How Bad? 21 ‣The IE 7 JavaScript engine runs up 8-times slower than Firefox 3 ‣Appcelerator’s page compiler does not appear to be optimized for IE 7 performance. ‣We observed 30% performance difference in the way Appcelerator runs text fields between IE 7 and Firefox 3. ‣Some commonly used Selenium functions are not optimized for performance. ‣We observed a 1798% performance difference by using different Selenium element locator techniques.
  • 22. Open Source Test Automation Test 1: No JavaScript 22 ‣Simple (almost no JavaScript) page (Google) ‣The total results of the tests were similar. 3800 ms for Firefox and 4000 ms for IE.
  • 23. Open Source Test Automation Caching Impact ‣Firefox Caches JavaScript Objects ‣Repeat for 1 Minute: ‣Plus IE7/Selenium Exceptions (8 times): Permission Denied 23
  • 24. Open Source Test Automation Test 2: Ajax Application ‣Javascript heavy site ‣Appcelerator’s Calendar sample that ships with PushToTest TestMaker 5.2.3 24
  • 25. Open Source Test Automation Resource Utilization 25 Firefox 3 IE 7
  • 26. Open Source Test Automation ‣Selenium Type Command using various element locator functions ‣This may be because of: ‣Slow JavaScript engine in IE. ‣Selenium not optimized for IE. ‣Slow xpath system engine (if any) in IE. Element Locator 26
  • 27. Open Source Test Automation Mitigation 27 ‣Run functional tests in Selenium RC with IE 7 and expect very long functional test times. ‣The test will complete eventually. ‣Do not compare the performance to the same test running on other browsers. ‣Run functional tests using HTMLUnit with an Internet Explorer profile. ‣Simulates IE functionality while using the faster Rhino JavaScript engine provided in HTMLUnit. ‣Details on PushToTest support for Selenium are found at http://selenium.pushtotest.com.
  • 28. Open Source Test Automation Best Practices ‣Build Test Components ‣Treat your tests as software ‣Easier to maintain ‣Resilient to application changes ‣Apply JUnit-style Test Techniques ‣Set-up, Run-test, Tear-down methods ‣Write Stateless Test Components ‣Test puts application into the correct state 28
  • 29. Open Source Test Automation We Recommend 29 Components Record -> Script Dynamic Locators Work With Devs Events Pause Use Static Values Storage Values Test and Trash Expect The Same Do Don’t
  • 30. Open Source Test Automation Resources ‣http://www.pushtotest.com/download-testmaker6-preview ‣http://seleniumhq.org ‣http://selenium.pushtotest.com ‣http://refcardz.dzone.com/refcardz/getting-started-selenium ‣http://refcardz.dzone.com/refcardz/getting-started-selenium-20 ‣http://www.pushtotest.com/products-comparison 30
  • 31. Open Source Test Automation Where To Go From Here ‣Please Complete The Evaluation Form ‣And We Will Send You The Slides ‣Watch A Screencast and Tutorial ‣http://www.pushtotest.com/screencastcentral ‣Attend An Open Source Test Workshop ‣http://workshop.pushtotest.com ‣Ask For A Proposal on Licenses, Training, Support, Consulting ‣Troy Amyett, +01 512-750-8769 (USA, Texas), troy@pushtotest.com 31

×