Chethan -

Here is what I understand.  You are writing some sort of batch
execution script (maybe written in Ruby?? - rspec, test::unit?) that
runs tests.  Your batch runner runs these scripts (in parallel or
maybe serially?) and some of them get stuck in unexpected popups and
you need a way to prevent this.

You have two solutions.

1) Your batch runner needs to be smart enough to kill a script that is
running longer than you think it should be.  This is problematic - how
do you know if it's just running slower before you kill it?  Of
course, you could probably safely assume that a script which normally
takes 10 minutes to run could be killed after running for hours.  If
this is what you want, you could probably wrap your test execution in
the timeout block like I showed you.

2) Your individual tests need to be smart enough to deal with
incorrect behavior.  The code that Tony provided can be helpful here,
but it really depends on what the problem is.  Inside a test case, it
seems like you would have better context to deal with the problem
rather than using the previous solution to deal with the test.

However, it sounds like your basic problem is with popups that stop
your execution (right?).  There are some solutions to this that have
been posted which are persistent popup killers (see solution #2 here
http://wiki.openqa.org/display/WTR/JavaScript+Pop+Ups).  You could
code some of your test cases to use these as well.

I'm not sure I'm answering your question.  Please provide some more
details if you still need help.

Alan

On Thu, Oct 16, 2008 at 9:50 AM, chethan sarathy
<[EMAIL PROTECTED]> wrote:
> Thanks Alan,
>
> I have one doubt pls clarify this.
>
> If i define this in one common place(say some lib file) this will take
> effect for all the time out scenarios..
>
> Eg: some time scripts will be expecting one pop up or unwanted pop up comes
> it couldn't under stand what to do with new pop up. these kind of scenarios
>
> Regards,
> Chethan
>
> --- On Thu, 16/10/08, Alan Baird <[EMAIL PROTECTED]> wrote:
>
> From: Alan Baird <[EMAIL PROTECTED]>
> Subject: [wtr-general] Re: How to use Watir::Exception::TimeOutException
> To: watir-general@googlegroups.com
> Date: Thursday, 16 October, 2008, 7:52 PM
>
> Chethan -
>
> Here is another way to add a generic timeout to any task using the
> Timeout
>  class.
>
> require 'timeout'
>
> n = 0
>
> begin
>   Timeout::timeout(5) do
>     loop do
>       puts n
>       n += 1
>       sleep (0.5)
>     end
>   end
> rescue Timeout::Error
>   p "oops timeout!!"
>   #~ exit
> end
>
> p "the end"
>
>
> ________________________________
>  Add more friends to your messenger and enjoy!  Invite them now.
> >
>
>
>

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