Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > continue execution when TEST::UNIT assertion fails

Reply
Thread Tools

continue execution when TEST::UNIT assertion fails

 
 
aidy
Guest
Posts: n/a
 
      04-16-2007
Hi,

Is is possible not to halt the execution of a ruby script when an
TEST::UNIT assertion fails?

cheers

aidy

 
Reply With Quote
 
 
 
 
Tim Pease
Guest
Posts: n/a
 
      04-16-2007
On 4/16/07, aidy <> wrote:
> Hi,
>
> Is is possible not to halt the execution of a ruby script when an
> TEST::UNIT assertion fails?
>


Yes, you can ...

begin
assert false
rescue Test::Unit::AssertionFailedError => e
self.send(:add_failure, e.message, e.backtrace)
end


Or if you would like a little method ...

def continue_test
begin
yield
rescue Test::Unit::AssertionFailedError => e
self.send(:add_failure, e.message, e.backtrace)
end
end

continue_test( assert false )


Blessings,
TwP

 
Reply With Quote
 
 
 
 
Tim Pease
Guest
Posts: n/a
 
      04-16-2007
On 4/16/07, Tim Pease <> wrote:
> On 4/16/07, aidy <> wrote:
> > Hi,
> >
> > Is is possible not to halt the execution of a ruby script when an
> > TEST::UNIT assertion fails?
> >

>
> Yes, you can ...
>
> begin
> assert false
> rescue Test::Unit::AssertionFailedError => e
> self.send(:add_failure, e.message, e.backtrace)
> end
>
>
> Or if you would like a little method ...
>
> def continue_test
> begin
> yield
> rescue Test::Unit::AssertionFailedError => e
> self.send(:add_failure, e.message, e.backtrace)
> end
> end
>
> continue_test( assert false )
>


Sorry, that should be a block

continue_test {assert false}

TwP

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Debugger - fails to "continue" with breakpoint set Ed Greenberg Python 1 09-17-2010 04:58 PM
continue the execution of a ruby script after a shell comand Hamlat Ameziane Ruby 3 07-17-2008 07:59 AM
private data stashed in local/global execution context of PyEval_EvalCode disappears down the execution stack sndive@gmail.com Python 9 11-14-2007 10:31 PM
How to continue request execution in a HttpHandler ori ASP .Net 1 05-30-2005 12:21 PM
How to continue execution after window.location has loaded anotherpage F. Da Costa Javascript 0 01-17-2004 11:27 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57