190 likes | 317 Views
Open Source Web Testing. Free You have the source Many people solving common problems. by Len Vaz – Moreover Technologies. Frameworks. Watir (Ruby) Selenium (Java) Watij (Java) HtmlUnit (Java) HttpUnit (Java) WET (C#). What to look for?. Documentation Active user groups
E N D
Open Source Web Testing Free You have the source Many people solving common problems by Len Vaz – Moreover Technologies
Frameworks • Watir (Ruby) • Selenium (Java) • Watij (Java) • HtmlUnit (Java) • HttpUnit (Java) • WET (C#)
What to look for? • Documentation • Active user groups • Browsers supported • Operating systems supported • Ease of use • Does it support what you are testing? • Logging, DB support, Reporting, VMWare • Look at existing test cases for other features
Stuff to help - 1 • A good IDE • http://www.eclipse.org/downloads/ • http://www.aptana.com/ • IE Developer toolbar • http://www.microsoft.com/downloads/details.aspx?familyid=e59c3964-672d-4511-bb3e-2d5e1db91038&displaylang=en • Firebug • https://addons.mozilla.org/en-US/firefox/addon/1843
Stuff to help - 2 • IRB – Interactive Ruby shell • Tab completion (.irbrc) • require ‘irb/completion’ • Persistent command history (.irbrc) • require ‘irb/ext/save-history’ • ARGV.concat [ "--readline", "--prompt-mode", "simple" ] • IRB.conf[:SAVE_HISTORY] = 100 • IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
Stuff to help - 3 • Turn off pop-up blockers • Have browser windows open to new windows • If you need UTF-8 support, add: • require 'win32ole' • WIN32OLE.codepage = WIN32OLE::CP_UTF8 • Make sure your data is utf8 encoded when saved • Problem dealing with frames – selenium??? • http://wiki.openqa.org/display/WTR/Frames • Use Ruby’s unit/test framework • http://www.ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html
Documentation • Watir • http://wtr.rubyforge.org/rdoc/ (Watir API) • http://www.ruby-doc.org/core/ (Ruby) • http://www.ruby-doc.org/stdlib/ (Ruby) • http://groups.google.com/group/watir-general (User group) • http://rubyforge.org/mailman/listinfo/wtr-development (dev) • http://wiki.openqa.org/display/WTR/Project+Home • Selenium • http://seleniumhq.org/documentation/ • LinkedIn (user group) • http://clearspace.openqa.org/community/selenium (forum) • http://www.jroller.com/selenium/
Selenium – Platform, Browser and Languages supported • Platforms • Windows, OS X, Linux, Solaris • Browsers • Firefox 2, 3; IE 7; Safari 2, 3; Opera 8, 9, Chrome • Languages • C#, Java, Perl, Python, PHP, Ruby
Watir – Platform, Browser and Languages supported • Platforms • Windows, OS X, Linux • Browsers • Firefox 2, 3; IE 7; Safari 2, 3; Chrome • Language • Ruby
Watir / Selenium Installation • Watir (http://wtr.rubyforge.org/install.html) • Install Ruby (http://rubyforge.org/frs/?group_id=167) • Install Watir (gem install watir) • Install jssh (http://wiki.openqa.org/download/attachments/13893658/jssh-20080708-WINNT.xpi) • Selenium • gem install selenium; gem install selenium-client (Ruby) • Install Java (http://www.java.com/en/download/manual.jsp) • Install Selenium (http://seleniumhq.org/download/) • Remote control & Selenium IDE
Watir example • require ‘watir’ • Watir.options[:browser]='firefox‘ • ie, firefox, safari, chrome • browser = Watir::Browser.new • browser.goto ‘http://www.google.com’ • browser.text_field(:id, 'q').set 'automation‘ • browser.button(:name, 'btnG').click • puts browser.title • browser.close
Selenium example • require ‘selenium/client’ • @browser = Selenium::Client::Driver.new("localhost", 4444, "*iexplore", "http://www.google.com", 10000); • iexplore, konqueror, firefox, mock, chrome, iehta, piiexplore, pifirefox, safari, opera, custom) • @browser.start_new_browser_session • @browser.open “/” • @browser.type “q”, “automation” • @browser.click “btnG”, :wait_for => :page • puts @browser.title • @browser.close_current_browser_session
Selenium components • Selenium IDE • Selenium Core • Selenium Remote Control • Selenium Grid