self shouldnt: [ whatever ] raise: Error.

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

self shouldnt: [ whatever ] raise: Error.

Philippe Marschall
Hi

Somebody decided that the following

self shouldnt: [ whatever ] raise: Error.
self shouldnt: [ whatever ] raise: Exception.

Should _always_ signal an Error in Pharo 3. Any ideas?

Cheers
Philippe
_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

Re: self shouldnt: [ whatever ] raise: Error.

Jan van de Sandt
Hi,


Cheers,
Jan


On Sun, Oct 20, 2013 at 3:17 PM, Philippe Marschall <[hidden email]> wrote:
Hi

Somebody decided that the following

self shouldnt: [ whatever ] raise: Error.
self shouldnt: [ whatever ] raise: Exception.

Should _always_ signal an Error in Pharo 3. Any ideas?

Cheers
Philippe
_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev


_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

Re: self shouldnt: [ whatever ] raise: Error.

Philippe Marschall
On Sun, Oct 20, 2013 at 3:23 PM, Jan van de Sandt <[hidden email]> wrote:
> Hi,
>
> Probably related to https://pharo.fogbugz.com/f/cases/11876

Can't access that :-(

Cheers
Philippe
_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

Re: self shouldnt: [ whatever ] raise: Error.

Jan van de Sandt


On Sun, Oct 20, 2013 at 3:31 PM, Philippe Marschall <[hidden email]> wrote:
On Sun, Oct 20, 2013 at 3:23 PM, Jan van de Sandt <[hidden email]> wrote:
> Hi,
>
> Probably related to https://pharo.fogbugz.com/f/cases/11876

Can't access that :-(

Cheers
Philippe
_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev


_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

Re: self shouldnt: [ whatever ] raise: Error.

Philippe Marschall
On Sun, Oct 20, 2013 at 3:40 PM, Jan van de Sandt <[hidden email]> wrote:
> It was also posted on the Pharo-dev mailing list:
> http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/2013-September/084101.html

I don't even know where to begin.

Cheers
Philippe
_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

Re: self shouldnt: [ whatever ] raise: Error.

Johan Brichau-2
Indeed.

In the case of the now failing tests in Seaside, it is actually meaningful to test if no error is thrown. The assertion is a documentation what is being tested.
At first thought, I had the idea that it was easy to remove the assertion since the test will fail if an error is thrown anyway. However, without the assertion, the meaning of the test now has to be written in comments.

The spirit behind the idea seems good, but enforcing it like this is counter-productive in some cases.

Johan

On 20 Oct 2013, at 15:53, Philippe Marschall <[hidden email]> wrote:

> On Sun, Oct 20, 2013 at 3:40 PM, Jan van de Sandt <[hidden email]> wrote:
>> It was also posted on the Pharo-dev mailing list:
>> http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/2013-September/084101.html
>
> I don't even know where to begin.
>
> Cheers
> Philippe
> _______________________________________________
> seaside-dev mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev

_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

Re: self shouldnt: [ whatever ] raise: Error.

Sven Van Caekenberghe-2
In reply to this post by Jan van de Sandt

On 20 Oct 2013, at 15:23, Jan van de Sandt <[hidden email]> wrote:

> Hi,
>
> Probably related to https://pharo.fogbugz.com/f/cases/11876

COPIED:

As pointed out on several occasions, writing test expression such as self shouldnt: [ ... ] raise: Error are counter productive. Testing for a specific error is sort of ok (still of mostly of no use).

=========================================================================================

I accidentally run the dev version of moose on a 2.0 to check if the VMs work properly
and I ran into a bunch of failing tests.

https://ci.inria.fr/pharo/view/3.0-VM/job/PharoVM-AcceptanceTest/27/SLAVE=pharo-linux.ci.inria.fr,TEST_IMAGE=vm-test.zip/testReport/

First of all, my problem, since I wanted to test the #stable release anyway.
In any case I had a look at the bugs since I was interested to see if it was
in any way VM-related:

https://ci.inria.fr/pharo/view/3.0-VM/job/PharoVM-AcceptanceTest/27/SLAVE=pharo-linux.ci.inria.fr,TEST_IMAGE=vm-test.zip/testReport/Moose.Tests.Finder/MooseFinderForSimpleClassesTest/testMenuEntriesForClasses/

Ok, 0 information :(, why? Because of #shouldnt:raise:.
On a linguistic basis the #shouldnt:raise: message makes sense, sort of the counter
part of #should:raise:... BUT how does it handle errors exactly?

Example 1:
----------
1:

    self shouldnt: [ 1 doeSomething ] raise: MessageNotUnderstood.
ok, seems fine, the test should fail, most probably with an assertion failure,
and this is what it does indeed.

Example 2:
----------
1:

    self shouldnt: [ 1/0 ] raise: MessageNotUnderstood.
will that now fail or not? Because it doesn't raise the MessageNotUnderstood,
so the logic conclusion is that it doesn't fail. Well, you're wrong, it WILL FAIL,
with a ZeroDivide, which is the major reason #shouldnt:raise: is not helpful.

That is utterly confusing and rather useless. Because you can just write
1:
2:
3:

   
   
1 doeSomething.

   
1/0.
- In case 1 you get an MessageNotUnderstood instead of an AssertionFailure => test fails in both cases
- In the second case you get the same message, so nothing to discuss about.

The interesting part is, that case 1 almost never happens like I've shown it.
Most of the time it looks more like this (including the failing moose tests):
1:

    self shouldnt: [ 1 doeSomething ] raise: Error.
   
This is in my eye useless, even worse, it is obstructing, since you basically
mute an otherwise useful error. In the original example, I was left with no
stack trace nor a decent reason why the test would fail. Whereas with a bit of
stack trace I would get reasonable context to start real debugging efforts.


Conclusion:
-----------
a) do not use #shouldnt:raise:
b) still don't use it
c) if you want to use #shouldnt:raise: for dubious reasons, use very specific errors you test for

> Cheers,
> Jan
>
>
> On Sun, Oct 20, 2013 at 3:17 PM, Philippe Marschall <[hidden email]> wrote:
> Hi
>
> Somebody decided that the following
>
> self shouldnt: [ whatever ] raise: Error.
> self shouldnt: [ whatever ] raise: Exception.
>
> Should _always_ signal an Error in Pharo 3. Any ideas?
>
> Cheers
> Philippe
> _______________________________________________
> seaside-dev mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>
> _______________________________________________
> seaside-dev mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev

_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

Re: self shouldnt: [ whatever ] raise: Error.

Philippe Marschall
In reply to this post by Johan Brichau-2
On Sun, Oct 20, 2013 at 4:17 PM, Johan Brichau <[hidden email]> wrote:
> Indeed.
>
> In the case of the now failing tests in Seaside, it is actually meaningful to test if no error is thrown. The assertion is a documentation what is being tested.
> At first thought, I had the idea that it was easy to remove the assertion since the test will fail if an error is thrown anyway. However, without the assertion, the meaning of the test now has to be written in comments.

Exactly, it's the difference between a failure and an error.

> The spirit behind the idea seems good, but enforcing it like this is counter-productive in some cases.

Exactly, enterprise architect thinking.

Cheers
Philippe
_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

Re: self shouldnt: [ whatever ] raise: Error.

Johan Brichau-2
So...

Apart from that, it is safe to actually remove the assertions and count on the error being thrown to mark the test as an (erroneous) failure.
I've got the changes pending for commit... or do we want to raise this issue?

Next, it seems we will need to duplicate and adapt the Seaside-Core-Pharo20-Tests to Seaside-Core-Pharo30-Tests because of a deprecation of #ensureFile to #ensureCreateFile. Since probably more changes are coming anyway, I guess it's something we need to do.

Johan

On 21 Oct 2013, at 11:08, Philippe Marschall <[hidden email]> wrote:

> On Sun, Oct 20, 2013 at 4:17 PM, Johan Brichau <[hidden email]> wrote:
>> Indeed.
>>
>> In the case of the now failing tests in Seaside, it is actually meaningful to test if no error is thrown. The assertion is a documentation what is being tested.
>> At first thought, I had the idea that it was easy to remove the assertion since the test will fail if an error is thrown anyway. However, without the assertion, the meaning of the test now has to be written in comments.
>
> Exactly, it's the difference between a failure and an error.
>
>> The spirit behind the idea seems good, but enforcing it like this is counter-productive in some cases.
>
> Exactly, enterprise architect thinking.
>
> Cheers
> Philippe
> _______________________________________________
> seaside-dev mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev

_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

Re: self shouldnt: [ whatever ] raise: Error.

Damien Cassou
On Tue, Oct 22, 2013 at 9:29 AM, Johan Brichau <[hidden email]> wrote:
> Apart from that, it is safe to actually remove the assertions and count on the error being thrown to mark the test as an (erroneous) failure.
> I've got the changes pending for commit... or do we want to raise this issue?


there are several discussions about this topic on the Pharo mailing
list. You may want to participate there.

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm."
Winston Churchill
_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

Re: self shouldnt: [ whatever ] raise: Error.

Johan Brichau-2

On 22 Oct 2013, at 09:32, Damien Cassou <[hidden email]> wrote:

> there are several discussions about this topic on the Pharo mailing
> list. You may want to participate there.

Ok, I did that.

Johan
_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

Re: self shouldnt: [ whatever ] raise: Error.

Philippe Marschall
In reply to this post by Johan Brichau-2
On Tue, Oct 22, 2013 at 9:29 AM, Johan Brichau <[hidden email]> wrote:
> So...
>
> Apart from that, it is safe to actually remove the assertions and count on the error being thrown to mark the test as an (erroneous) failure.
> I've got the changes pending for commit... or do we want to raise this issue?

I'm torn between introducing WATestCate (with a work around for this)
and dropping support for Pharo 3.0 altogether. I'm not willing to
sacrifice fidelity on other platforms for this and we're quickly
approaching the point where we spend more time keeping Seaside running
on the latest Pharo an actually improving Seaside.

Cheers
Philippe
_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev