Created
September 20, 2011 23:50
-
-
Save alisterscott/1230762 to your computer and use it in GitHub Desktop.
simple watir-webdriver threading example for load testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'thread' | |
require 'watir-webdriver' | |
def test_google | |
3.times do | |
browser = Watir::Browser.start 'http://www.etsy.com', :chrome | |
browser.text_field(:name, 'search_query').set 'hat' | |
start_time = Time.now | |
browser.button(:text, 'Search').click | |
end_time = Time.now | |
puts end_time - start_time | |
browser.close | |
end | |
end | |
threads = [] | |
30.times do | |
threads << Thread.new {test_google} | |
end | |
threads.each {|x| x.join} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this code !