The teardown script automatically runs at the completion of all test functions. The alphabetical order only affects multiple test_* functions. If you have:
def setup end def test_01 end def test_02 end def teardown end They will run in this order: setup, test_01, teardown, setup, test_02, teardown. So if you have 66 tests, only the ones that are called after the first testname should fail, because you're closing the browser and the logger after the first test runs. Hope that helps, Adam -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lauren Sent: Monday, June 18, 2007 2:23 PM To: wtr-general@rubyforge.org Subject: [Wtr-general] Method Precedence confusion Hello, I apologize for my confusion yet again, but I hope this will be a simple answer for someone... I have written a script that asserts whether labels on a page exist or not. Here is a small snippet of code to serve as an example: class TC_banking_info_labels < Test::Unit::TestCase include Watir def test_bank_name assert($ie.span(:text, "bank name").exists?) $logger.log(" FOUND! Banking Information: 'Bank Name' field...") end end I have discovered that the order of operation within the class is alphabetical. (method test_a* will execute before test_z*). My problem is that I have a teardown script located in another file. I can access the methods in the files just fine by accessing them directly. For example by typing in: $close_logger $close_browser The problem with that is that my teardown methods/variables get executed before my Test::Unit::TestCase classes/methods which causes my browser to close before my tests are executed, which causes all 66 of my tests to fail. Here are the contents of my teardown.rb script: require 'watir' #includes for using logger require 'example_logger1' $close_logger = $logger.log("## Testing Complete ##") $close_browser = $ie.close My question is: How can I call this teardown script into my test script and have it executed LAST. How do I control the order in which methods are executed? As always, thank you for your help. I have been researching quite a bit about methods & classes, etc...but there is still a disconnect somewhere...and I am stuck. _______________________________________________ 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