On Mon, Oct 13, 2008 at 10:25 AM, Natasha <[EMAIL PROTECTED]> wrote:

>
> Hello All,
>
> Just wanted to check if anyone knows about how to take care of
> exception handling in Watir.
>
> Basically I have created individual watir scripts and now want to
> create a test suite (a master script) which will call each of these.
>
> I have written a simple master script, which uses require statement to
> call each of these scripts and have declared some global variables
> which can be accessed by each of these scripts.
>
> Now the problem that I got was, at times some of these scripts failed,
> due to probable bug in the application and hence my master script also
> terminated. I tried to look for exception handling techniques for Ruby
> and found 'begin ... rescue .. ensure ..end' statements. I did use
> this in one of my scripts, but still the master script terminated,
> when the modified script failed and hence other scripts didn't execute
> at all. So I want to ensure that eventhough one test case fails, the
> execution for the other scripts should continue.
>
> Just wanted to check with the group, if anyone has applied exception
> handling in their scripts or if there is a link to help me with this
> query.
>
> Thanks in advance,
> Natasha


Hi Natasha,
Perhaps you can consider this option

class MyMasterRunner

  def self.run_this
    begin
      #call your script here
    rescue => e
      #oops. Exception occured. That's ok
      # catch it here and continue running next in queue
    end
  end

  def self.run_that
    begin
      #call your script here
    rescue => e
      #ooops. Exception occured. That's ok
      #catch it here and continue running next in queue
    end
  end
end

# RUN My Tests
MyMasterRunner.run_this
MyMasterRunner.run_that

Of course it would not be smart to run it with TestUnit framework because
they have their own exception handling.


-- 
marekj

www.testr.us | semantic test objects modeling in watir

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to