[Pharo-project] #assert:equals: feels backwards

laurent laffont laurent.laffont at gmail.com
Wed Jun 22 01:44:22 EDT 2011


Camillo and Dennis,

Thanks for answer and yes, I think you're right about using
PhExample/Mocketry DSL, that's the way to go.

Laurent.


On Wed, Jun 22, 2011 at 6:31 AM, Dennis Schetinin <chaetal at gmail.com> wrote:

>
>
> 2011/6/22 laurent laffont <laurent.laffont at gmail.com>
>
>> IMO having the expected value before is the right way ! Do you TDD ? It
>> makes a lot of sense for me to write assert: expected equals: actual. Am I
>> alone ?
>>
>
> I practice TDD, and I start tests with assertions (after naming them). But
> I'm not sure I specify expected value first, as I'm focused on the result (I
> write the test for). Btw, I use Mocketry and exploit its sugar (or DSL?) for
> specifications there. So, I write:
>
> actualValue should equal: expectedValue.
>
>
> That is, after I've decided on a test case and named it, I think: what
> should I test? That's the actualValue. I name and write it. And only after
> that, I think about the value it should have… well, in most cases at least.
>
> Anyway, I'm not sure an order I use to write assertion should be repeated
> by assertion messages. Just as order I use to write a test (name ->
> assertion -> the way to fetch the actual value -> …) is not reflected by
> test code. It's much more important to have a readable and understandable
> (after many months) code. And for me it's much more natural to read it this
> way:
>
> self assert: actualValue equals: expectedValue
>
>
>
>
> If you do TDD, you have first to decide what you expect. You don't know how
>> to get it because the code doesn't exist yet. So you usually I write
>>
>> self assert: 'i want this' equals:
>>
>> then stop because I have to think about the interface / selectors / object
>> I want. So it matches the flow of thought when I'm writing tests.
>>
>> And the other weird thing is that with this "fix" I now have to change
>> hundred of tests I've written to be semantically correct !!!!
>>
>>
>> Laurent.
>>
>>
>> On Wed, Jun 22, 2011 at 12:39 AM, Sean P. DeNigris <sean at clipperadams.com
>> > wrote:
>>
>>>
>>> Mariano Martinez Peck wrote:
>>> >
>>> > I don't understand Sean's problem.
>>> >
>>>
>>> Still using 1.2.2 :) Thanks for fixing it.
>>>
>>> Sean
>>>
>>> --
>>> View this message in context:
>>> http://forum.world.st/assert-equals-feels-backwards-tp3614760p3615548.html
>>> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>>>
>>>
>>
>
>
> --
> Dennis Schetinin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20110622/863ed2e5/attachment-0001.html>


More information about the Pharo-dev mailing list