[squeak-dev] Why is TestFailure non-resumable?

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

[squeak-dev] Why is TestFailure non-resumable?

Eliot Miranda-2
Hi All,

    if I want to run through a complex test that tests a number of combinations, some of which have failures, its convenient to wrap the test in an exception handler for TestFailure and run the tests resuming on each failure.  But I can't because TestFaiure isn't resumable.  Any good reason why?

e.g. I'm currently testing the generation of a divide/remainder routine for the x86 where I'm enumerating over many combinations of register quads, dividend, divisor, quotient, remainder, and I'd like to do the following to count how many failures I'm getting with each tweak of the register juggling code:

 | count |
 count := 0.
[CogIA32CompilerTests new testDivQuoRem]
on: TestResult failure
do: [:ex| count := count + 1. ex resume].
count


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Why is TestFailure non-resumable?

Colin Putney

On 10-Sep-09, at 1:52 PM, Eliot Miranda wrote:

> Hi All,
>
>     if I want to run through a complex test that tests a number of  
> combinations, some of which have failures, its convenient to wrap  
> the test in an exception handler for TestFailure and run the tests  
> resuming on each failure.  But I can't because TestFaiure isn't  
> resumable.  Any good reason why?
>
> e.g. I'm currently testing the generation of a divide/remainder  
> routine for the x86 where I'm enumerating over many combinations of  
> register quads, dividend, divisor, quotient, remainder, and I'd like  
> to do the following to count how many failures I'm getting with each  
> tweak of the register juggling code:

Well, SUnit wasn't designed to be used that way. Each test is supposed  
to have a binary result. Either it passes, or it doesn't. Sometimes  
the UI distinguishes between an assertion failing and an error, but  
that's sort of incidental. So TestFailure isn't resumable because we  
already have a result for the test: it failed. There's no need to  
continue executing the test, because further failures don't give any  
new information. In fact, further assertions are meaningless - we  
already know that *something* isn't as it should be. If further  
assertions fail, does that indicate additional problems, or the same  
one manifesting its self in different ways?

The "proper" way to do this in SUnit would be to have a whole bunch of  
different tests that run the same code with different inputs. That's  
probably not practical.  A better way would be to write your own test  
harness. SUnit is great, but it's not the last word on testing, right?

Colin

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Why is TestFailure non-resumable?

Casey Ransberger
One clue might be that what Eliot wants to do is probably not a unit test.

On Sat, Sep 12, 2009 at 2:22 PM, Colin Putney <[hidden email]> wrote:

On 10-Sep-09, at 1:52 PM, Eliot Miranda wrote:

Hi All,

   if I want to run through a complex test that tests a number of combinations, some of which have failures, its convenient to wrap the test in an exception handler for TestFailure and run the tests resuming on each failure.  But I can't because TestFaiure isn't resumable.  Any good reason why?

e.g. I'm currently testing the generation of a divide/remainder routine for the x86 where I'm enumerating over many combinations of register quads, dividend, divisor, quotient, remainder, and I'd like to do the following to count how many failures I'm getting with each tweak of the register juggling code:

Well, SUnit wasn't designed to be used that way. Each test is supposed to have a binary result. Either it passes, or it doesn't. Sometimes the UI distinguishes between an assertion failing and an error, but that's sort of incidental. So TestFailure isn't resumable because we already have a result for the test: it failed. There's no need to continue executing the test, because further failures don't give any new information. In fact, further assertions are meaningless - we already know that *something* isn't as it should be. If further assertions fail, does that indicate additional problems, or the same one manifesting its self in different ways?

The "proper" way to do this in SUnit would be to have a whole bunch of different tests that run the same code with different inputs. That's probably not practical.  A better way would be to write your own test harness. SUnit is great, but it's not the last word on testing, right?

Colin




--
Ron


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Why is TestFailure non-resumable?

Eliot Miranda-2
In reply to this post by Colin Putney


On Sat, Sep 12, 2009 at 2:22 PM, Colin Putney <[hidden email]> wrote:

On 10-Sep-09, at 1:52 PM, Eliot Miranda wrote:

Hi All,

   if I want to run through a complex test that tests a number of combinations, some of which have failures, its convenient to wrap the test in an exception handler for TestFailure and run the tests resuming on each failure.  But I can't because TestFaiure isn't resumable.  Any good reason why?

e.g. I'm currently testing the generation of a divide/remainder routine for the x86 where I'm enumerating over many combinations of register quads, dividend, divisor, quotient, remainder, and I'd like to do the following to count how many failures I'm getting with each tweak of the register juggling code:

Well, SUnit wasn't designed to be used that way. Each test is supposed to have a binary result. Either it passes, or it doesn't. Sometimes the UI distinguishes between an assertion failing and an error, but that's sort of incidental. So TestFailure isn't resumable because we already have a result for the test: it failed. There's no need to continue executing the test, because further failures don't give any new information. In fact, further assertions are meaningless - we already know that *something* isn't as it should be. If further assertions fail, does that indicate additional problems, or the same one manifesting its self in different ways?

The "proper" way to do this in SUnit would be to have a whole bunch of different tests that run the same code with different inputs. That's probably not practical.  A better way would be to write your own test harness. SUnit is great, but it's not the last word on testing, right?


Yes, but on the other hand, making TestFailure resumable does not in any way break SUnit (AFAICS) and yet makes the framework more generally useful.  So I propose, unless anyone can find a good reason, making it resumable.  Then one doesn't have to replicate the bulk of the framework to do what I want, something anyone testing operations with many combinations will likely find useful.
 

Colin



Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Why is TestFailure non-resumable?

Colin Putney

On 12-Sep-09, at 3:37 PM, Eliot Miranda wrote:

> Yes, but on the other hand, making TestFailure resumable does not in  
> any way break SUnit (AFAICS) and yet makes the framework more  
> generally useful.  So I propose, unless anyone can find a good  
> reason, making it resumable.  Then one doesn't have to replicate the  
> bulk of the framework to do what I want, something anyone testing  
> operations with many combinations will likely find useful.

That *was* a good reason. :-)

But then, my opinion doesn't matter much. I'm not the maintainer of  
SUnit, and the Squeak community has historically had no qualms about  
breaking compatibility with SUnit on other dialects. I'm sure if you  
commit that change, no one will even notice.

*grumble grumble grumble*

Colin



Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Why is TestFailure non-resumable?

Lukas Renggli
> But then, my opinion doesn't matter much. I'm not the maintainer of SUnit,
> and the Squeak community has historically had no qualms about breaking
> compatibility with SUnit on other dialects. I'm sure if you commit that
> change, no one will even notice.

FYI: At ESUG SUnit started to move again. SUnit 3.2 was released too.

http://www.slideshare.net/esug/just-in-time-resourcing

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Why is TestFailure non-resumable?

Philippe Marschall
2009/9/13 Lukas Renggli <[hidden email]>:
>> But then, my opinion doesn't matter much. I'm not the maintainer of SUnit,
>> and the Squeak community has historically had no qualms about breaking
>> compatibility with SUnit on other dialects. I'm sure if you commit that
>> change, no one will even notice.
>
> FYI: At ESUG SUnit started to move again. SUnit 3.2 was released too.
>
> http://www.slideshare.net/esug/just-in-time-resourcing

There seem to be two SUnit 3.2 versions:

http://sunit.sourceforge.net/devel.htm

Cheers
Philippe

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Why is TestFailure non-resumable?

dcorking
On Sun, Sep 13, 2009 at 10:05 AM, Philippe Marschall  wrote:
>> FYI: At ESUG SUnit started to move again. SUnit 3.2 was released too.
>>
>> http://www.slideshare.net/esug/just-in-time-resourcing
>
> There seem to be two SUnit 3.2 versions:
>
> http://sunit.sourceforge.net/devel.htm
>
That was last updated in 2003.

FYI there are also at least two Work-In-Progress SUnit projects at
Squeak Source:

http://www.squeaksource.com/SUnit (Marcus Denker, Lukas, Mironenko
Yuriy Ivanovich, 2007)
http://www.squeaksource.com/Testing  (Keith Hodges, 2009)

Lukas / Keith  - will Niall's changes be included in your trees?

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Why is TestFailure non-resumable?

Lukas Renggli
> FYI there are also at least two Work-In-Progress SUnit projects at
> Squeak Source:
>
> http://www.squeaksource.com/SUnit (Marcus Denker, Lukas, Mironenko
> Yuriy Ivanovich, 2007)

This repository contains SUnit 3.2 as it was released by Niall Ross at
ESUG. The changes have yet to be integrated into Pharo though.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Why is TestFailure non-resumable?

dcorking
Lukas Renggli  wrote:

>> http://www.squeaksource.com/SUnit (Marcus Denker, Lukas, Mironenko
>> Yuriy Ivanovich, 2007)
>
> This repository contains SUnit 3.2 as it was released by Niall Ross at
> ESUG. The changes have yet to be integrated into Pharo though.

Great, thanks Lukas.  I assume you mean
SUnit-niall.valuableChanges3.1to3.2.mcz 2009-08-30 15:57:30
SUnit-niall.FULL.3.2.mcz 2009-08-30 18:01:43

Yesterday, I didn't spot them at the bottom of the web page (which
lists files in alpha order.)
Sorry, David