Hugh, I will stick to mine... I am a nubie and I understood very little of what you just wrote... I am sure as I go along and get more skilled... It will start to make sense... But for the new guy (me)... Readability & understandability is important...
Thanks, Thom -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hugh Sasse Sent: Tuesday, February 07, 2006 3:38 PM To: [email protected] Subject: Re: [Wtr-general] Assertions help On Tue, 7 Feb 2006, Thomas Healy wrote: > Paul, > > It seems that you need a fail case for when it fails, I have run into > the same thing yesterday... when I used the "rescue => e" it seems to > work... in my case... the script that works for me is... > > begin > assert($ie.contains_text("User profile has been updated.") ) > $logger.log("###USER UPDATE TEST PASSED####' ") > $logger.log_results("test_b_add_new_user", "User profile has been > updated.", "User profile has been updated.", "TEST PASSED.") rescue => > e > $logger.log("###USER UPDATE TEST FAILED####" + e.message + "\n" + > e.backtrace.join("\n")) > $logger.log_results("test_b_add_new_user", "User profile has been > updated.", "User profile has been updated.", "TEST FAILED.") > end You are making work for yourself, I think. Watir is based on Test::Unit and it works like this: brains hgs 112 %> cat !$ cat ./test_unit_example #!/usr/local/bin/ruby -w # Example usage of Test::Unit require 'test/unit' class Testy < Test::Unit::TestCase def test_assertions assert(false, "this Will fail") assert(false, "So will this, but you won't see it.") end end brains hgs 113 %> So you get: brains hgs 113 %> ./test_unit_example Loaded suite ./test_unit_example Started F Finished in 0.048761 seconds. 1) Failure: test_assertions(Testy) [./test_unit_example:10]: this Will fail. <false> is not true. 1 tests, 1 assertions, 1 failures, 0 errors brains hgs 114 %> If there is a failure in one test, only so many assertions are completed. That test is then halted before any other assertions can be run, and then the other test_... methods are called. So you write each test method so that it works on its own. You can use methods called setup and teardown to do preliminary work before, and cleanup afterwards. http://www.rubygarden.org/ruby?UsingTestUnit http://www.ruby-doc.org/stdlib/libdoc/test/unit/rdoc/index.html I've entered in the middle of this, so sorry if you knew that already. > > Regards, > > Thom HTH Hugh _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
