[Cuis-dev] Test error message wrongly formatted

Juan Vuletich juan at cuis.st
Mon Jul 24 04:41:23 PDT 2023


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 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230724/6f82803d/attachment.htm>


More information about the Cuis-dev mailing list