SUnit error handling discrepancy

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

SUnit error handling discrepancy

keith1y
In sunit, running a test as normal collects the errors via an explicit
exception handler
Running a test with #debug doesn't, it leaves it to the system exception
handler to do do its normal thing with a debugger. However if the
#defaultAction for that signal does not raise UnhandledError then the
debugger does not appear.

The result being that clicking on a test case in the errors list, does
not do anything.

So the question is.

1) should SUnit only trap Unhandled errors, in its error count?
2) Or should #debug trap errors like #run does ?

Keith

               
___________________________________________________________
All New Yahoo! Mail – Tired of Vi@gr@! come-ons? Let our SpamGuard protect you. http://uk.docs.yahoo.com/nowyoucan.html

Reply | Threaded
Open this post in threaded view
|

Re: SUnit error handling discrepancy

Damien Cassou-3
2007/3/13, Keith Hodges <[hidden email]>:
> 1) should SUnit only trap Unhandled errors, in its error count?
> 2) Or should #debug trap errors like #run does ?

What is the meaning of #debug: ? Currently I use it in my test
comments to rapidly execute a test. It's better than #run: because it
raises a debugger on which I can see what was wrong.

--
Damien Cassou

Reply | Threaded
Open this post in threaded view
|

Re: SUnit error handling discrepancy

keith1y
Damien Cassou wrote:
> 2007/3/13, Keith Hodges <[hidden email]>:
>> 1) should SUnit only trap Unhandled errors, in its error count?
>> 2) Or should #debug trap errors like #run does ?
>
> What is the meaning of #debug: ? Currently I use it in my test
> comments to rapidly execute a test. It's better than #run: because it
> raises a debugger on which I can see what was wrong.
I am sorry I was not clear enough, option 2 should read

2) Or should #debug trap errors like #run does, and open a debugger on
the caught errors, rather than leaving it to the default handler to open
the debugger which doesnt always happen.

So if you write a test

testThis
    "self debug:#testThis"
    InvalidDirectoryError pathName: '/example') signal

The test above will raise an error in the TestRunner, however it will
not open a debugger when you execute the test via #debug:. This is
because InvalidDirectoryError has a #defaultAction defined which returns
#{} rather than raising a UnhandledError exception.

So the question is, should TestRunner be changed to only catch
UnhandleErrors, or should #debug be changed to catch all errors.

I have gone for the latter, and uploaded the fix to
http://www.squeaksource.com/Testing in order to try it out.

Keith





               
___________________________________________________________
Try the all-new Yahoo! Mail. "The New Version is radically easier to use" � The Wall Street Journal
http://uk.docs.yahoo.com/nowyoucan.html