Re: [Wtr-general] I am having problems with assert -- undefined method `assert'
Eva wrote: Hi, I used the following assert script from the logger example (test_logger1.rb) begin assert($ie.contains_text(Client) ) $logger.log(Passed. Found test string 'Client' ) $logger.log_results(Employee Tests, TEST PASSED.) #logs to both the XML file and corelogger rescue = e $logger.log(*FAILED*. + e.message + \n + e.backtrace.join(\n)) $logger.log_results(Employee Tests, TEST FAILED.) #logs to both the XML file and corelogger end I receive this error *FAILED*.undefined method `assert' for main:Object We have found that the assert/rescue logic described here is both confusing and, if misunderstood, capable of creating horrible errors in scripts that allow errors to not be reported. Consequently, I have revised these examples to avoid the assert/rescue logic. These are attached. Bret #includes require 'watir' include Watir #test::unit includes require 'test/unit' require 'test/unit/ui/console/testrunner' #logger includes require 'example_logger1' class TC_google_logging Test::Unit::TestCase def start #open the IE browser $ie = IE.new filePrefix = test_logger1 #create a logger $logger = LoggerFactory.start_xml_logger(filePrefix) $ie.set_logger($logger) end def test_a_simplesearch #call start method... start #fires up the IE browser and a logger object #variables test_site = 'http://www.google.com' # $logger.log() $logger.log(## Beginning of test: Google search) #logs only to corelogger file $logger.log(Step 1: Go to the Google site: www.google.com) $ie.goto(test_site) $logger.log( Action: entered + test_site + in the address bar.) $logger.log(Step 2: Enter 'pickaxe' in the search text field) $ie.text_field(:name, q).set(pickaxe) $logger.log( Action: entered pickaxe in the search field) $logger.log(Step 3: Click the 'Google Search' button) $ie.button(:name, btnG).click $logger.log( Action: clicked the Google Search button.) $logger.log(Expected Result: ) $logger.log( - A Google page with results should be shown. 'Programming Ruby' should be high on the list.) $logger.log(Actual Result: Check that the 'Programming Ruby' link actually appears on the page by using an assertion) if $ie.text.include?(Programming Ruby) $logger.log(Passed. Found test string 'Programming Ruby' ) $logger.log_results(test_a_simplesearch, pickaxe, Programming Ruby, TEST PASSED.) #logs to both the XML file and corelogger else $logger.log(*FAILED*.) $logger.log_results(test_a_simplesearch, pickaxe, Programming Ruby, TEST FAILED.) #logs to both the XML file and corelogger end $logger.log ## End of test: google search\n end # end of test_simplesearch def test_b_googlenews #variables test_site = 'http://news.google.com' $logger.log(## Beginning of test: Google News) $logger.log(Step 1: go to the Google news site: news.google.com) $ie.goto(test_site) $logger.log( Action: entered + test_site + in the address bar.) $logger.log(Step 2: Select Canada from the Top Stories drop-down list) $ie.select_list( :index , 1).select(Canada English) $logger.log( Action: selected Canada from the drop-down list.) $logger.log(Step 3: click the 'Go' button) $ie.button(:caption, Go).click $logger.log( Action: clicked the Go button.) $logger.log(Expected Result: ) $logger.log( - The Google News Canada site should be displayed) $logger.log( Actual Result: Check that 'Canada' appears on the page by using an assertion) if $ie.text.include?(Canada) $logger.log(TEST PASSED. Found test string 'Canada' ) $logger.log_results(test_b_googlenews, Canada English, Canada, TEST PASSED.) #logs to both the XML file and corelogger else $logger.log(TEST FAILED.) $logger.log_results(test_b_googlenews, Canada English, Canada, TEST FAILED.) #logs to both the XML file and corelogger end $logger.log '## End of test: Google news selection' $logger.end_log #close XML log file end # end of test_googlenews end #end of class TC_google_logging ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Javascript Alert windows
I committed this change as recommended. Thanks Matt, Mark and David. http://svn.openqa.org/fisheye/changelog/watir/?cs=1115 Bret Matt Johnson wrote: Thank you, adding include Win32 worked. -- MattJ On 10/9/06, *Cain, Mark* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: You could also just put include Win32 right above the def enabled_popup(timeout=4) in /watir/contrib/enabled_popup.rb --Mark -Original Message- From: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]] On Behalf Of David Schmidt Sent: Saturday, October 07, 2006 7:07 PM To: wtr-general@rubyforge.org mailto:wtr-general@rubyforge.org; [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Subject: Re: [Wtr-general] Javascript Alert windows Matt, The problem is that when the enabled_popup method was removed from watir.rb the definitions for GetWindows() definition wasn't moved with it. Afterwards, the definition for GetWindows was moved in the watir.rb file so that it is no longer found by enabled_popup. If you look in the watir.rb file for GetWindow and move those definitions into the enabled_popup.rb file then it should work fine. David Schmidt -- [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Javascript Alert windows
I submitted this bug: http://jira.openqa.org/browse/WTR-112 http://jira.openqa.org/browse/WTR-112 Thank you. I've committed the fix. You can either build your own gem from trunk or else wait for the next development gem (in say the next week) to confirm. Would you be interested in unit tests for this module? I am not confident of my ruby skills at this point, but that might be a good exercise for me and possibly helpful to you? That would be awesome. I've been thinking of writing up guidelines on how to write Watir Unit tests, and certainly am willing to help if you have questions about this. Bret ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Wikipedia Article Feedback
Sun -- Thanks for all your work with Wikipedia article. It really looks good. http://en.wikipedia.org/wiki/Watir One comment (Testers show their love with bug reports): The article recommend Ruby 1.8.4 for Watir 1.4.1, which is fine, but it also recommends 1.8.4 for Watir 1.5. There are known problems using Ruby 1.8.4 with Watir 1.5. http://jira.openqa.org/browse/WTR-86 I recommend that people using Watir 1.5 should use Ruby 1.8.2. At least until i fix this bug. Bret ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] JavasScript Menu .click not working
i had to sent an onmouseover fireevent to use the change location function. Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Chris McMahon Gesendet: Montag, 9. Oktober 2006 17:16 An: wtr-general@rubyforge.org Betreff: Re: [Wtr-general] JavasScript Menu .click not working did not create objects like the onclick method does but i fixed it ^^ my boss is happy and so am i. How did you fix it? ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] looping test cases?
Hi, I am trying to do something like: def test_random_stuff 1.upto(100) do |stuff| #each test is somewhat randomized assert_no_match(certain error) end #do end #test_random_stuff current behavior: test/unit exits the test case as soon as an assertion fails. what I'd like to end up with is a test that passes or fails and then runs again either way. It might generate a list of pass/fail results from my random tests, something like: dataset 1 pass dataset 2 pass dataset 3 fail dataset 4 pass dataset 5 fail ... dataset 100 pass How would you suggest going about this? Thanks, Jeff ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Wikipedia Article Feedback
I haven't had this issue using Ruby 1.8.5_21 and Watir 1.5.x. --Mark -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bret Pettichord Sent: Monday, October 09, 2006 10:04 PM To: wtr-general@rubyforge.org Subject: [Wtr-general] Wikipedia Article Feedback Sun -- Thanks for all your work with Wikipedia article. It really looks good. http://en.wikipedia.org/wiki/Watir One comment (Testers show their love with bug reports): The article recommend Ruby 1.8.4 for Watir 1.4.1, which is fine, but it also recommends 1.8.4 for Watir 1.5. There are known problems using Ruby 1.8.4 with Watir 1.5. http://jira.openqa.org/browse/WTR-86 I recommend that people using Watir 1.5 should use Ruby 1.8.2. At least until i fix this bug. Bret ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] looping test cases?
On 10/10/06, Jeff Fry [EMAIL PROTECTED] wrote: Hi, I am trying to do something like: def test_random_stuff 1.upto(100) do |stuff| #each test is somewhat randomized assert_no_match(certain error) end #do end #test_random_stuff current behavior: test/unit exits the test case as soon as an assertion fails. what I'd like to end up with is a test that passes or fails and then runs again either way. It might generate a list of pass/fail results from my random tests, something like: dataset 1 pass dataset 2 pass dataset 3 fail dataset 4 pass dataset 5 fail ... dataset 100 pass How would you suggest going about this? Thanks, Jeff def test_random_stuff 1.upto(100) do |stuff| begin #each test is somewhat randomized assert_no_match(certain error) puts passedrescue = eputs error: + e.to_send #begin end #do end #test_random_stuff ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] looping test cases?
Jeff Fry wrote: def test_random_stuff 1.upto(100) do |stuff| #each test is somewhat randomized assert_no_match(certain error) end #do end #test_random_stuff current behavior: test/unit exits the test case as soon as an assertion fails. what I'd /like /to end up with is a test that passes or fails and then runs again either way. It might generate a list of pass/fail results from my random tests, something like: dataset 1 pass dataset 2 pass dataset 3 fail dataset 4 pass dataset 5 fail ... dataset 100 pass How would you suggest going about this? There are two ways to do this. 1. Use verify instead of assert. I've recently released a verify method, which is backwards compatable with 1.4. This works like assert, except that it does not abort a test case. However, using it will only result in a list of failures, not passes. 2. Dynamically create your test case methods. What you will have to do is on the first pass (at load time), generate all your test case methods. These will then be executed. This is more complex, but will give you the results you request. class MyTest Test::Unit::TestCase 100.times do | count | method_name = :test_#{count} define_method method_name do #each test is somewhat randomized assert_no_match(certain error) end end end ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] cell access
Span and theIndex are good for locating items. In order to construct a loop and access all items, how does one find out the number of items in a span element? - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=4509messageID=13072#13072 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Wikipedia Article Feedback
Thanks. I will say I have had no apparent problems using win32ole functionality with the 1.8.4 version of Ruby I have installed -- not with Watir 1.4.1, nor with any of the 1.5.x builds. So...maybe I have just been lucky? - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=4727messageID=13076#13076 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Javascript Alert windows - include Win32
Putting in: == include Win32 == without quotation marks, above the: == def enabled_popup(timeout=4) == is indeed the fix. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=4715messageID=13079#13079 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] OT: Ruby linguistics
For all the DSL people, you have to read this: http://www.deveiate.org/projects/Linguistics/wiki/English ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general