From bret at pettichord.com Mon Oct 16 15:42:55 2006 From: bret at pettichord.com (Bret Pettichord) Date: Mon, 16 Oct 2006 14:42:55 -0500 Subject: [Wtr-development] simplifying watir syntax Message-ID: Here are some ideas i have for a new simpler Watir syntax. Of course, the old ways would continue to work. Any comments?These examples show all the code you would need to write. Bret Simple Block Syntax require 'watir' Watir::IE.new do goto('http://www.google.com') text_field(:name, 'q').set 'ruby' button(:name, 'btnG').click end This would be useful for simple automation. Support simple "Watir" scripts script.rb: goto('http://www.google.com') text_field(:name, 'q').set 'ruby' button(:name, 'btnG').click Execute it with: > watir script.rb Scripts can be specified on the command line > watir -e "goto('http://www.google.com'); text_field(:name, 'q').set 'ruby'; button(:name, 'btnG').click" Also, very useful for simple automation (rather than testing). Simple test case require 'watir/testcase' class MyTest < Watir::TestCase def my_test goto('http://www.google.com') text_field(:name, 'q').set 'ruby' button(:name, 'btnG').click assert(text.include? 'pickaxe') end end Putting it all together test1.rb: goto('http://www.google.com') text_field(:name, 'q').set 'ruby' button(:name, 'btnG').click assert(text.include? 'pickaxe') test2.rb: goto('http://www.google.com') text_field(:name, 'q').set 'watir' button(:name, 'btnG').click assert(text.include? 'Holy Grail') >From the command line: > watir -t test*.rb This would automatically run the tests, creating a testcase wrapper for each test and then executing the combined suite. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-development/attachments/20061016/48ee02f7/attachment.html From schandra at friendster.com Fri Oct 20 21:38:04 2006 From: schandra at friendster.com (Chandra Siva) Date: Fri, 20 Oct 2006 18:38:04 -0700 Subject: [Wtr-development] multiple IE process share the same session cookies Message-ID: <62D6B7C12242244DA66D9A4428688D9201CC7659@fiexchange.friendster.local> I am using WATIR 1.5.1.1100 with Ruby 1.8.2 (2004-12-25) and trying to use the new Watir::IE.new_process to create multiple concurrent instances of IE to performance test a web application. I need each of those instances to have their version of the permanent or at least their own session cookies. I am finding that in spite of using the new_process method, the session cookie set in one seems to overwrite another. Any clues on how to achieve what I am trying to do with Watir. Here is my test script : #----------------------------------------------------------------------- --------------------------------------# # Test to see if WATIR works with multiple IE processes with their own cookie jars. #----------------------------------------------------------------------- -------------------------------------# require 'rubygems' require 'watir' # the watir controller require 'watir/contrib/ie-new-process' def test_echo_cookie (thread_index) # set a variable url = 'http://localhost/echo_cookie.php'; show_url = "#{url}?cmd=show&name=index"; create_url = "#{url}?cmd=create&name=index&value=#{thread_index}&type=s"; # open the IE browser # browser = Watir::IE.new browser = Watir::IE.new_process browser.logger.level = Logger::ERROR # This should create a cookie browser.goto(create_url); # Show what was created browser.goto(show_url); puts "#{thread_index} : content : #{browser.text}"; browser.kill end # run the same test 10 times concurrently in separate browser instances threads = [] 10.times do |i| threads << Thread.new {test_echo_cookie(i)} end threads.each {|x| x.join} And my echo_cookie.php script simply sets and displays cookies based on some parameters: This is the output I get from running the WATIR script: Process ID: 4116 Process ID: 4684 Process ID: 4764 Process ID: 2800 Process ID: 5124 Process ID: 2228 Process ID: 5876 Process ID: 1512 Process ID: 5932 Process ID: 2768 3 : content : index=2 2 : content : index=2 1 : content : index=1 0 : content : index=2 5 : content : index=2 4 : content : index=2 6 : content : index=2 7 : content : index=2 8 : content : index=8 9 : content : index=8 ------------------------------------------------ Chandra Siva Architect, Friendster http://www.friendster.com/chandra123 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-development/attachments/20061020/22b161b5/attachment-0001.html From jim at hollcraft.com Sun Oct 29 23:39:44 2006 From: jim at hollcraft.com (Jim Hollcraft) Date: Sun, 29 Oct 2006 20:39:44 -0800 Subject: [Wtr-development] Suggested Fix for wait_until_test.rb Message-ID: In RSpec version 0.6.4, the name spaces have been refactored. Spec::Api::Mock becomes Spec::Mocks::Mock. Unit test passes after these changes with RSpec v0.6.4 installed. Please let me know if there is a better way to submit these suggestions. Index: wait_until_test.rb =================================================================== --- wait_until_test.rb (revision 1120) +++ wait_until_test.rb (working copy) @@ -20,7 +20,7 @@ def setup @waiter = Watir::Waiter.new @waiter.timeout = 10.0 - @mock_checkee = Spec::Api::Mock.new "mock_checkee" + @mock_checkee = Spec::Mocks::Mock.new "mock_checkee" # remove this line to test with actual TimeKeeper intead of the Mock # (slower, but more accurate) @@ -73,7 +73,7 @@ class WaitUntilClassTest < Watir::TestCase def setup - @mock_checkee = Spec::Api::Mock.new "mock_checkee" + @mock_checkee = Spec::Mocks::Mock.new "mock_checkee" @mock_checkee.should_receive(:check).exactly(3).times.and_return [false, false, true] end From bret at pettichord.com Mon Oct 30 02:46:21 2006 From: bret at pettichord.com (Bret Pettichord) Date: Mon, 30 Oct 2006 01:46:21 -0600 Subject: [Wtr-development] Suggested Fix for wait_until_test.rb In-Reply-To: References: Message-ID: Thanks for patch. I committed it to trunk. This is a good way to submit patches. Bret On 10/29/06, Jim Hollcraft wrote: > > In RSpec version 0.6.4, the name spaces have been refactored. > Spec::Api::Mock becomes Spec::Mocks::Mock. Unit test passes after these > changes with RSpec v0.6.4 installed. Please let me know if there is a > better way to submit these suggestions. > > Index: wait_until_test.rb > =================================================================== > --- wait_until_test.rb (revision 1120) > +++ wait_until_test.rb (working copy) > @@ -20,7 +20,7 @@ > def setup > @waiter = Watir::Waiter.new > @waiter.timeout = 10.0 > - @mock_checkee = Spec::Api::Mock.new "mock_checkee" > + @mock_checkee = Spec::Mocks::Mock.new "mock_checkee" > > # remove this line to test with actual TimeKeeper intead of the > Mock > # (slower, but more accurate) > @@ -73,7 +73,7 @@ > class WaitUntilClassTest < Watir::TestCase > > def setup > - @mock_checkee = Spec::Api::Mock.new "mock_checkee" > + @mock_checkee = Spec::Mocks::Mock.new "mock_checkee" > @mock_checkee.should_receive(:check).exactly(3).times.and_return > [false, false, true] > end > _______________________________________________ > Wtr-development mailing list > Wtr-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-development > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wtr-development/attachments/20061030/a31cae91/attachment.html From bret at pettichord.com Mon Oct 16 15:42:55 2006 From: bret at pettichord.com (Bret Pettichord) Date: Mon, 16 Oct 2006 14:42:55 -0500 Subject: [Wtr-development] simplifying watir syntax Message-ID: Here are some ideas i have for a new simpler Watir syntax. Of course, the old ways would continue to work. Any comments?These examples show all the code you would need to write. Bret Simple Block Syntax require 'watir' Watir::IE.new do goto('http://www.google.com') text_field(:name, 'q').set 'ruby' button(:name, 'btnG').click end This would be useful for simple automation. Support simple "Watir" scripts script.rb: goto('http://www.google.com') text_field(:name, 'q').set 'ruby' button(:name, 'btnG').click Execute it with: > watir script.rb Scripts can be specified on the command line > watir -e "goto('http://www.google.com'); text_field(:name, 'q').set 'ruby'; button(:name, 'btnG').click" Also, very useful for simple automation (rather than testing). Simple test case require 'watir/testcase' class MyTest < Watir::TestCase def my_test goto('http://www.google.com') text_field(:name, 'q').set 'ruby' button(:name, 'btnG').click assert(text.include? 'pickaxe') end end Putting it all together test1.rb: goto('http://www.google.com') text_field(:name, 'q').set 'ruby' button(:name, 'btnG').click assert(text.include? 'pickaxe') test2.rb: goto('http://www.google.com') text_field(:name, 'q').set 'watir' button(:name, 'btnG').click assert(text.include? 'Holy Grail') >From the command line: > watir -t test*.rb This would automatically run the tests, creating a testcase wrapper for each test and then executing the combined suite. -------------- next part -------------- An HTML attachment was scrubbed... URL: From schandra at friendster.com Fri Oct 20 21:38:04 2006 From: schandra at friendster.com (Chandra Siva) Date: Fri, 20 Oct 2006 18:38:04 -0700 Subject: [Wtr-development] multiple IE process share the same session cookies Message-ID: <62D6B7C12242244DA66D9A4428688D9201CC7659@fiexchange.friendster.local> I am using WATIR 1.5.1.1100 with Ruby 1.8.2 (2004-12-25) and trying to use the new Watir::IE.new_process to create multiple concurrent instances of IE to performance test a web application. I need each of those instances to have their version of the permanent or at least their own session cookies. I am finding that in spite of using the new_process method, the session cookie set in one seems to overwrite another. Any clues on how to achieve what I am trying to do with Watir. Here is my test script : #----------------------------------------------------------------------- --------------------------------------# # Test to see if WATIR works with multiple IE processes with their own cookie jars. #----------------------------------------------------------------------- -------------------------------------# require 'rubygems' require 'watir' # the watir controller require 'watir/contrib/ie-new-process' def test_echo_cookie (thread_index) # set a variable url = 'http://localhost/echo_cookie.php'; show_url = "#{url}?cmd=show&name=index"; create_url = "#{url}?cmd=create&name=index&value=#{thread_index}&type=s"; # open the IE browser # browser = Watir::IE.new browser = Watir::IE.new_process browser.logger.level = Logger::ERROR # This should create a cookie browser.goto(create_url); # Show what was created browser.goto(show_url); puts "#{thread_index} : content : #{browser.text}"; browser.kill end # run the same test 10 times concurrently in separate browser instances threads = [] 10.times do |i| threads << Thread.new {test_echo_cookie(i)} end threads.each {|x| x.join} And my echo_cookie.php script simply sets and displays cookies based on some parameters: This is the output I get from running the WATIR script: Process ID: 4116 Process ID: 4684 Process ID: 4764 Process ID: 2800 Process ID: 5124 Process ID: 2228 Process ID: 5876 Process ID: 1512 Process ID: 5932 Process ID: 2768 3 : content : index=2 2 : content : index=2 1 : content : index=1 0 : content : index=2 5 : content : index=2 4 : content : index=2 6 : content : index=2 7 : content : index=2 8 : content : index=8 9 : content : index=8 ------------------------------------------------ Chandra Siva Architect, Friendster http://www.friendster.com/chandra123 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jim at hollcraft.com Sun Oct 29 23:39:44 2006 From: jim at hollcraft.com (Jim Hollcraft) Date: Sun, 29 Oct 2006 20:39:44 -0800 Subject: [Wtr-development] Suggested Fix for wait_until_test.rb Message-ID: In RSpec version 0.6.4, the name spaces have been refactored. Spec::Api::Mock becomes Spec::Mocks::Mock. Unit test passes after these changes with RSpec v0.6.4 installed. Please let me know if there is a better way to submit these suggestions. Index: wait_until_test.rb =================================================================== --- wait_until_test.rb (revision 1120) +++ wait_until_test.rb (working copy) @@ -20,7 +20,7 @@ def setup @waiter = Watir::Waiter.new @waiter.timeout = 10.0 - @mock_checkee = Spec::Api::Mock.new "mock_checkee" + @mock_checkee = Spec::Mocks::Mock.new "mock_checkee" # remove this line to test with actual TimeKeeper intead of the Mock # (slower, but more accurate) @@ -73,7 +73,7 @@ class WaitUntilClassTest < Watir::TestCase def setup - @mock_checkee = Spec::Api::Mock.new "mock_checkee" + @mock_checkee = Spec::Mocks::Mock.new "mock_checkee" @mock_checkee.should_receive(:check).exactly(3).times.and_return [false, false, true] end From bret at pettichord.com Mon Oct 30 02:46:21 2006 From: bret at pettichord.com (Bret Pettichord) Date: Mon, 30 Oct 2006 01:46:21 -0600 Subject: [Wtr-development] Suggested Fix for wait_until_test.rb In-Reply-To: References: Message-ID: Thanks for patch. I committed it to trunk. This is a good way to submit patches. Bret On 10/29/06, Jim Hollcraft wrote: > > In RSpec version 0.6.4, the name spaces have been refactored. > Spec::Api::Mock becomes Spec::Mocks::Mock. Unit test passes after these > changes with RSpec v0.6.4 installed. Please let me know if there is a > better way to submit these suggestions. > > Index: wait_until_test.rb > =================================================================== > --- wait_until_test.rb (revision 1120) > +++ wait_until_test.rb (working copy) > @@ -20,7 +20,7 @@ > def setup > @waiter = Watir::Waiter.new > @waiter.timeout = 10.0 > - @mock_checkee = Spec::Api::Mock.new "mock_checkee" > + @mock_checkee = Spec::Mocks::Mock.new "mock_checkee" > > # remove this line to test with actual TimeKeeper intead of the > Mock > # (slower, but more accurate) > @@ -73,7 +73,7 @@ > class WaitUntilClassTest < Watir::TestCase > > def setup > - @mock_checkee = Spec::Api::Mock.new "mock_checkee" > + @mock_checkee = Spec::Mocks::Mock.new "mock_checkee" > @mock_checkee.should_receive(:check).exactly(3).times.and_return > [false, false, true] > end > _______________________________________________ > Wtr-development mailing list > Wtr-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-development > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bret at pettichord.com Mon Oct 16 15:42:55 2006 From: bret at pettichord.com (Bret Pettichord) Date: Mon, 16 Oct 2006 14:42:55 -0500 Subject: [Wtr-development] simplifying watir syntax Message-ID: Here are some ideas i have for a new simpler Watir syntax. Of course, the old ways would continue to work. Any comments?These examples show all the code you would need to write. Bret Simple Block Syntax require 'watir' Watir::IE.new do goto('http://www.google.com') text_field(:name, 'q').set 'ruby' button(:name, 'btnG').click end This would be useful for simple automation. Support simple "Watir" scripts script.rb: goto('http://www.google.com') text_field(:name, 'q').set 'ruby' button(:name, 'btnG').click Execute it with: > watir script.rb Scripts can be specified on the command line > watir -e "goto('http://www.google.com'); text_field(:name, 'q').set 'ruby'; button(:name, 'btnG').click" Also, very useful for simple automation (rather than testing). Simple test case require 'watir/testcase' class MyTest < Watir::TestCase def my_test goto('http://www.google.com') text_field(:name, 'q').set 'ruby' button(:name, 'btnG').click assert(text.include? 'pickaxe') end end Putting it all together test1.rb: goto('http://www.google.com') text_field(:name, 'q').set 'ruby' button(:name, 'btnG').click assert(text.include? 'pickaxe') test2.rb: goto('http://www.google.com') text_field(:name, 'q').set 'watir' button(:name, 'btnG').click assert(text.include? 'Holy Grail') >From the command line: > watir -t test*.rb This would automatically run the tests, creating a testcase wrapper for each test and then executing the combined suite. -------------- next part -------------- An HTML attachment was scrubbed... URL: From schandra at friendster.com Fri Oct 20 21:38:04 2006 From: schandra at friendster.com (Chandra Siva) Date: Fri, 20 Oct 2006 18:38:04 -0700 Subject: [Wtr-development] multiple IE process share the same session cookies Message-ID: <62D6B7C12242244DA66D9A4428688D9201CC7659@fiexchange.friendster.local> I am using WATIR 1.5.1.1100 with Ruby 1.8.2 (2004-12-25) and trying to use the new Watir::IE.new_process to create multiple concurrent instances of IE to performance test a web application. I need each of those instances to have their version of the permanent or at least their own session cookies. I am finding that in spite of using the new_process method, the session cookie set in one seems to overwrite another. Any clues on how to achieve what I am trying to do with Watir. Here is my test script : #----------------------------------------------------------------------- --------------------------------------# # Test to see if WATIR works with multiple IE processes with their own cookie jars. #----------------------------------------------------------------------- -------------------------------------# require 'rubygems' require 'watir' # the watir controller require 'watir/contrib/ie-new-process' def test_echo_cookie (thread_index) # set a variable url = 'http://localhost/echo_cookie.php'; show_url = "#{url}?cmd=show&name=index"; create_url = "#{url}?cmd=create&name=index&value=#{thread_index}&type=s"; # open the IE browser # browser = Watir::IE.new browser = Watir::IE.new_process browser.logger.level = Logger::ERROR # This should create a cookie browser.goto(create_url); # Show what was created browser.goto(show_url); puts "#{thread_index} : content : #{browser.text}"; browser.kill end # run the same test 10 times concurrently in separate browser instances threads = [] 10.times do |i| threads << Thread.new {test_echo_cookie(i)} end threads.each {|x| x.join} And my echo_cookie.php script simply sets and displays cookies based on some parameters: This is the output I get from running the WATIR script: Process ID: 4116 Process ID: 4684 Process ID: 4764 Process ID: 2800 Process ID: 5124 Process ID: 2228 Process ID: 5876 Process ID: 1512 Process ID: 5932 Process ID: 2768 3 : content : index=2 2 : content : index=2 1 : content : index=1 0 : content : index=2 5 : content : index=2 4 : content : index=2 6 : content : index=2 7 : content : index=2 8 : content : index=8 9 : content : index=8 ------------------------------------------------ Chandra Siva Architect, Friendster http://www.friendster.com/chandra123 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jim at hollcraft.com Sun Oct 29 23:39:44 2006 From: jim at hollcraft.com (Jim Hollcraft) Date: Sun, 29 Oct 2006 20:39:44 -0800 Subject: [Wtr-development] Suggested Fix for wait_until_test.rb Message-ID: In RSpec version 0.6.4, the name spaces have been refactored. Spec::Api::Mock becomes Spec::Mocks::Mock. Unit test passes after these changes with RSpec v0.6.4 installed. Please let me know if there is a better way to submit these suggestions. Index: wait_until_test.rb =================================================================== --- wait_until_test.rb (revision 1120) +++ wait_until_test.rb (working copy) @@ -20,7 +20,7 @@ def setup @waiter = Watir::Waiter.new @waiter.timeout = 10.0 - @mock_checkee = Spec::Api::Mock.new "mock_checkee" + @mock_checkee = Spec::Mocks::Mock.new "mock_checkee" # remove this line to test with actual TimeKeeper intead of the Mock # (slower, but more accurate) @@ -73,7 +73,7 @@ class WaitUntilClassTest < Watir::TestCase def setup - @mock_checkee = Spec::Api::Mock.new "mock_checkee" + @mock_checkee = Spec::Mocks::Mock.new "mock_checkee" @mock_checkee.should_receive(:check).exactly(3).times.and_return [false, false, true] end From bret at pettichord.com Mon Oct 30 02:46:21 2006 From: bret at pettichord.com (Bret Pettichord) Date: Mon, 30 Oct 2006 01:46:21 -0600 Subject: [Wtr-development] Suggested Fix for wait_until_test.rb In-Reply-To: References: Message-ID: Thanks for patch. I committed it to trunk. This is a good way to submit patches. Bret On 10/29/06, Jim Hollcraft wrote: > > In RSpec version 0.6.4, the name spaces have been refactored. > Spec::Api::Mock becomes Spec::Mocks::Mock. Unit test passes after these > changes with RSpec v0.6.4 installed. Please let me know if there is a > better way to submit these suggestions. > > Index: wait_until_test.rb > =================================================================== > --- wait_until_test.rb (revision 1120) > +++ wait_until_test.rb (working copy) > @@ -20,7 +20,7 @@ > def setup > @waiter = Watir::Waiter.new > @waiter.timeout = 10.0 > - @mock_checkee = Spec::Api::Mock.new "mock_checkee" > + @mock_checkee = Spec::Mocks::Mock.new "mock_checkee" > > # remove this line to test with actual TimeKeeper intead of the > Mock > # (slower, but more accurate) > @@ -73,7 +73,7 @@ > class WaitUntilClassTest < Watir::TestCase > > def setup > - @mock_checkee = Spec::Api::Mock.new "mock_checkee" > + @mock_checkee = Spec::Mocks::Mock.new "mock_checkee" > @mock_checkee.should_receive(:check).exactly(3).times.and_return > [false, false, true] > end > _______________________________________________ > Wtr-development mailing list > Wtr-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-development > -------------- next part -------------- An HTML attachment was scrubbed... URL: