[wtr-general] Re: Please Explain core_tests.rb
Please do not that although you can't run these tests from the gem, you *can* run them if you pull the development source. A great way to learn what this code does is to run it and then start changing lines and see what happens. I do it all the time. Bret Mark Anderson wrote: This seemed like an interesting challenge. I've tried to provide links to reference materials on the commands. I have a ruby-doc.org in my browser's bookmark bar because I visit it often. Please ask more specific questions if any of the following does not make sense. /\/\ark # these are the non-xpath tests that do not need to be visible # This sets the global constant $HIDE_IE to true $HIDE_IE = true # This sets the constant TOPDIR to refer to the parent directory # of the one where the file lives # I couldn't find rdoc or a pickaxe reference for __FILE__, but # here is a nice blog post: # http://neeraj.name/blog/articles/228-__file__-in-ruby # File.join and File.dirname documented at: # http://www.ruby-doc.org/core/classes/File.html TOPDIR = File.join(File.dirname(__FILE__), '..') # This prepends TOPDIR to the beginning of the $LOAD_PATH array # (http://www.ruby-doc.org/core/classes/Array.html#M002194) $LOAD_PATH.unshift TOPDIR # Documentation for require: # http://www.ruby-doc.org/core/classes/Kernel.html#M005967 require 'unittests/setup' # Changes the current working directory of the process to TOPDIR # (http://www.ruby-doc.org/core/classes/Dir.html#M002339) Dir.chdir TOPDIR # $all_tests is an array that is constructed when we require'd # unittests/setup above. It contains strings that describe # filenames. We want to require each of those files. # (Docs for each: #http://www.ruby-doc.org/core/classes/Array.html#M002196) $all_tests.each {|x| require x} # I found the source code for Watir::UnitTest here: # http://svn.openqa.org/fisheye/browse/watir/trunk/commonwatir/unittests/setup /watir-unittest.rb?r=trunk # I know that this code is being used to filter out some test # cases, specifically ones that match a case-insensitive regex, # but I'm not completely clear on how it works. Watir::UnitTest.filter_out do |test| test.class.to_s =~ /xpath/i end # This uses the same code to filter out tests that are # tagged with :must_be_visible, which makes sense since # we appear to be running IE hidden. Watir::UnitTest.filter_out_tests_tagged :must_be_visible -Original Message- From: watir-general@googlegroups.com [mailto:watir- [EMAIL PROTECTED] On Behalf Of Vivek P.Netha Sent: Tuesday, December 09, 2008 11:36 AM To: Watir General Subject: [wtr-general] Please Explain core_tests.rb Hello, my Watir fanatic brethren... I have been an avid Watir user for more than two years now. But I've mostly been helping with small web applications, with consequently small test bases, on and off. I have a basic question to ask of you experts out there. I'd like someone to explain to me, each line, each method that is used in the core_tests.rb file. I realize it doesn't work anymore after FireWatir integration. But it seems like a good way to run Watir scripts when you have a whole suite of them with you. I mean, I know $HIDE_IE does. I think though that that is the extent of it. I'm not really sure what .join does or .unshift does or generally how the whole script is intended to work together. Any comments are duly appreciated. Thanks, Vivek. __ Information from ESET NOD32 Antivirus, version of virus signature database 3678 (20081209) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 3679 (20081209) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 3682 (20081210) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Please Explain core_tests.rb
Er, Please do NOTE that ... Bret Pettichord wrote: Please do not that although you can't run these tests from the gem, you *can* run them if you pull the development source. A great way to learn what this code does is to run it and then start changing lines and see what happens. I do it all the time. Bret Mark Anderson wrote: This seemed like an interesting challenge. I've tried to provide links to reference materials on the commands. I have a ruby-doc.org in my browser's bookmark bar because I visit it often. Please ask more specific questions if any of the following does not make sense. /\/\ark # these are the non-xpath tests that do not need to be visible # This sets the global constant $HIDE_IE to true $HIDE_IE = true # This sets the constant TOPDIR to refer to the parent directory # of the one where the file lives # I couldn't find rdoc or a pickaxe reference for __FILE__, but # here is a nice blog post: # http://neeraj.name/blog/articles/228-__file__-in-ruby # File.join and File.dirname documented at: # http://www.ruby-doc.org/core/classes/File.html TOPDIR = File.join(File.dirname(__FILE__), '..') # This prepends TOPDIR to the beginning of the $LOAD_PATH array # (http://www.ruby-doc.org/core/classes/Array.html#M002194) $LOAD_PATH.unshift TOPDIR # Documentation for require: # http://www.ruby-doc.org/core/classes/Kernel.html#M005967 require 'unittests/setup' # Changes the current working directory of the process to TOPDIR # (http://www.ruby-doc.org/core/classes/Dir.html#M002339) Dir.chdir TOPDIR # $all_tests is an array that is constructed when we require'd # unittests/setup above. It contains strings that describe # filenames. We want to require each of those files. # (Docs for each: #http://www.ruby-doc.org/core/classes/Array.html#M002196) $all_tests.each {|x| require x} # I found the source code for Watir::UnitTest here: # http://svn.openqa.org/fisheye/browse/watir/trunk/commonwatir/unittests/setup /watir-unittest.rb?r=trunk # I know that this code is being used to filter out some test # cases, specifically ones that match a case-insensitive regex, # but I'm not completely clear on how it works. Watir::UnitTest.filter_out do |test| test.class.to_s =~ /xpath/i end # This uses the same code to filter out tests that are # tagged with :must_be_visible, which makes sense since # we appear to be running IE hidden. Watir::UnitTest.filter_out_tests_tagged :must_be_visible -Original Message- From: watir-general@googlegroups.com [mailto:watir- [EMAIL PROTECTED] On Behalf Of Vivek P.Netha Sent: Tuesday, December 09, 2008 11:36 AM To: Watir General Subject: [wtr-general] Please Explain core_tests.rb Hello, my Watir fanatic brethren... I have been an avid Watir user for more than two years now. But I've mostly been helping with small web applications, with consequently small test bases, on and off. I have a basic question to ask of you experts out there. I'd like someone to explain to me, each line, each method that is used in the core_tests.rb file. I realize it doesn't work anymore after FireWatir integration. But it seems like a good way to run Watir scripts when you have a whole suite of them with you. I mean, I know $HIDE_IE does. I think though that that is the extent of it. I'm not really sure what .join does or .unshift does or generally how the whole script is intended to work together. Any comments are duly appreciated. Thanks, Vivek. __ Information from ESET NOD32 Antivirus, version of virus signature database 3678 (20081209) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 3679 (20081209) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 3682 (20081210) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---