[Cuis-dev] Re : Re: Test error message wrongly formatted

Juan Vuletich juan at cuis.st
Mon Jul 24 06:13:11 PDT 2023


Hi Hilaire,

On 7/24/2023 10:02 AM, H. Fernandes via Cuis-dev wrote:
> Folks,
>
> Read carefully what I wrote because we have some misunderstanding :-)
>
> Dr. Geo -- http://drgeo.eu
>

I've read what you said several times. Yes, it seems we have some 
misunderstanding. So, it is best to be explicit, as I can not easily see 
your screen, and what you are seeing.

If I evaluate:

TestCase new assert: 'actual value' equalsExpected: 'expected value'

I get a debugger with title:

TestFailure: Expected 'expected value' but was 'actual value'. - 
Process: Morphic UI - Priority: 40

I think this is a correct error message. What message do you get with 
this example? What message do you think it would be correct instead?

Or is there a different example that you think it's wrong? If so, please 
paste a simple doit, the message you get, and the message you'd prefer.

Thanks!

> ----- Hernán Wilkinson via Cuis-dev<cuis-dev at lists.cuis.st> a écrit :
>> Hi,
>> sorry Hilaire, I didn't quite understand your first email.
>> As Juan says, I see the right error message in the debugger when the:
>> assertion fails.
>> I agree with keeping both message as you suggest Juan
>>
>> Cheers!
>> Hernan.
>>
>> On Mon, Jul 24, 2023 at 8:41 AM Juan Vuletich via Cuis-dev<
>> cuis-dev at lists.cuis.st>  wrote:
>>
>>> Hi Folks,
>>>
>>> On 7/24/2023 5:23 AM, Hilaire Fernandes via Cuis-dev wrote:
>>>
>>> Hi Hernán,
>>>
>>> I am not asking to add a message, the second one I mentioned is already in
>>> the image and may be should be removed (#assert:equalsExpected:)
>>>
>>> The problem with the method #asserted:expected:) is that the error message
>>> is wrong when the test fails, and I am pretty sure I never saw it that way
>>> before. I have used tests extensively.
>>>
>>>
>>> On a fresh, updated Cuis, `TestCase new assert: 'actual value'
>>> equalsExpected: 'expected value'` opens a debugger with title "TestFailure:
>>> Expected 'expected value' but was 'actual value'. - Process: Morphic UI -
>>> Priority: 40".
>>>
>>> Looks right to me...
>>>
>>> Alternatively, reversing the argument in the methos as shown below will
>>> fix it:
>>>
>>> ...
>>>
>>> self comparingStringBetween: *actual* and: *expected*
>>>
>>> *...*
>>>
>>>
>>> and make the error message read right.
>>>
>>> Hilaire
>>> Le 24/07/2023 à 04:29, Hernán Wilkinson via Cuis-dev a écrit :
>>>
>>> Hi Hilaire
>>> I think all of us that used #assert:equals: had the same feeling as you
>>> someday.
>>> We all expect the actual to be first, but for some reason I do not know
>>> Kent Beck put the expected first when he wrote SUnit and all the
>>> descendant testing framework followed that convention (JUnit, NUnit,
>>> phpunit, etc etc).
>>> We should not change it for historical and compatibility reasons.
>>> Adding the message you suggest will not harm, but it is redundant...
>>> My advice, give it a couple of days, you will get used to it to put the
>>> expected first, it is a matter of time.
>>>
>>>
>>> I think clarity trumps historical reasons. In any case, it is best to have
>>> both variants and let callers decide which they prefer.
>>>
>>> Thanks,
>>>
>>> --
>>> Juan Vuletichcuis.stgithub.com/jvuletichresearchgate.net/profile/Juan-Vuletichindependent.academia.edu/JuanVuletichpatents.justia.com/inventor/juan-manuel-vuletichlinkedin.com/in/juan-vuletich-75611b3twitter.com/JuanVuletich
>>>
>>> --
>>> Cuis-dev mailing list
>>> Cuis-dev at lists.cuis.st
>>> https://lists.cuis.st/mailman/listinfo/cuis-dev
>>>
>>
>> -- 
>>
>> *Hernán WilkinsonAgile Software Development, Teaching&  Coaching*
>> *Phone: +54-011*-4893-2057
>> *Twitter: @HernanWilkinson*
>> *site: http://www.10Pines.com<http://www.10pines.com/>*
>> Address: Alem 896, Floor 6, Buenos Aires, Argentina


-- 
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich



More information about the Cuis-dev mailing list