[Ann] New version of Mocketry 3.0

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

[Ann] New version of Mocketry 3.0

Denis Kudriashov
I am glad to present simplest mocks for Pharo.
In this version Mocketry is dramatically improved and changed.  I try to provide most simple way to stub any message to any object and to verify any occurred behaviour.


Here is short example:

mock := Mock new.
mock stub someMessage willReturn: 1000.
mock someMessage should be: 1000.
mock should got someMessage.
mock should not got anotherMessage.
rect := 0@0 corner: 2@3.
rect stub width willReturn: 1000.
rect area should be: 3000 "area = width * height".
rect should got width.
Reply | Threaded
Open this post in threaded view
|

Re: [Ann] New version of Mocketry 3.0

Denis Kudriashov
And I add chapters in PharoInProgress

2016-04-06 14:29 GMT+02:00 Denis Kudriashov <[hidden email]>:
I am glad to present simplest mocks for Pharo.
In this version Mocketry is dramatically improved and changed.  I try to provide most simple way to stub any message to any object and to verify any occurred behaviour.


Here is short example:

mock := Mock new.
mock stub someMessage willReturn: 1000.
mock someMessage should be: 1000.
mock should got someMessage.
mock should not got anotherMessage.
rect := 0@0 corner: 2@3.
rect stub width willReturn: 1000.
rect area should be: 3000 "area = width * height".
rect should got width.

Reply | Threaded
Open this post in threaded view
|

Re: [Ann] New version of Mocketry 3.0

Tudor Girba-2
In reply to this post by Denis Kudriashov
Hi,

Nice work!

Just the English does not sound quite well for statements like:
        mock should got someMessage
        mock should not got anotherMessage.

I know that there was a long discussion about naming these. I do not remember the outcome, but still I think other alternatives would be better:
        mock should haveReceived someMessage.
        mock should not haveReceived anotherMessage.
or even
        mock shouldnt haveReceived anotherMessage.


Also, for this statement:
        mock stub someMessage willReturn: 1000.

I think I would favor:
        mock stub someMessage toReturn: 1000.
or
        mock stub someMessage returns: 1000.


What do you think?

Cheers,
Doru



> On Apr 6, 2016, at 5:29 AM, Denis Kudriashov <[hidden email]> wrote:
>
> I am glad to present simplest mocks for Pharo.
> In this version Mocketry is dramatically improved and changed.  I try to provide most simple way to stub any message to any object and to verify any occurred behaviour.
>
> You can read full details in my blog http://dionisiydk.blogspot.fr/2016/04/new-version-of-mocketry-30.html 
>
> Here is short example:
>
> mock := Mock new.
> mock stub someMessage willReturn: 1000.
>
> mock someMessage should be: 1000.
> mock should got someMessage.
> mock should not got anotherMessage.
>
> rect := 0@0 corner: 2@3.
> rect stub width willReturn: 1000.
>
> rect area should be: 3000 "area = width * height".
> rect should got width.

--
www.tudorgirba.com
www.feenk.com

"Every thing has its own flow."






Reply | Threaded
Open this post in threaded view
|

Re: [Ann] New version of Mocketry 3.0

Denis Kudriashov

2016-04-06 14:51 GMT+02:00 Tudor Girba <[hidden email]>:
Just the English does not sound quite well for statements like:
        mock should got someMessage
        mock should not got anotherMessage.

I know that there was a long discussion about naming these. I do not remember the outcome, but still I think other alternatives would be better:
        mock should haveReceived someMessage.
        mock should not haveReceived anotherMessage.
or even
        mock shouldnt haveReceived anotherMessage.

You right. There was discussion and I made decision :)
Some of people suggest "should got" which is very short version and I like it. I know it is not completely correct from English perspective but it is readable enough and understandable. 
#shouldnt can be good. But usually we not use "should not" assertions. Only when we really want to deny certain condition we write it such way. In that cases full form of "should not" feels better for me.

But it is always personal choice. So I made decision. (many my tests uses "should not" :))

I think I would favor:
        mock stub someMessage toReturn: 1000.
or
        mock stub someMessage returns: 1000.

What do you think?
 
Same here.
Mocketry is very old and it was always idea of will:. You can also put block for expected action:
        mock stub someMessage will: [#yourResult].
        (mock stub someMessageWith: Any) will: [:arg | arg + 1].

Reply | Threaded
Open this post in threaded view
|

Re: [Ann] New version of Mocketry 3.0

Tudor Girba-2
Hi,

> On Apr 6, 2016, at 6:13 AM, Denis Kudriashov <[hidden email]> wrote:
>
>
> 2016-04-06 14:51 GMT+02:00 Tudor Girba <[hidden email]>:
> Just the English does not sound quite well for statements like:
>         mock should got someMessage
>         mock should not got anotherMessage.
>
> I know that there was a long discussion about naming these. I do not remember the outcome, but still I think other alternatives would be better:
>         mock should haveReceived someMessage.
>         mock should not haveReceived anotherMessage.
> or even
>         mock shouldnt haveReceived anotherMessage.
>
> You right. There was discussion and I made decision :)
> Some of people suggest "should got" which is very short version and I like it. I know it is not completely correct from English perspective but it is readable enough and understandable.

It is your prerogative :), but “should got" sounds broken :(.

> #shouldnt can be good. But usually we not use "should not" assertions. Only when we really want to deny certain condition we write it such way. In that cases full form of "should not" feels better for me.
> But it is always personal choice. So I made decision. (many my tests uses "should not" :))

I think “should not" sounds fine like it is.

Cheers,
Doru



> I think I would favor:
>         mock stub someMessage toReturn: 1000.
> or
>         mock stub someMessage returns: 1000.
>
> What do you think?
>  
> Same here.
> Mocketry is very old and it was always idea of will:. You can also put block for expected action:
>         mock stub someMessage will: [#yourResult].
>         (mock stub someMessageWith: Any) will: [:arg | arg + 1].
>

--
www.tudorgirba.com
www.feenk.com

"What is more important: To be happy, or to make happy?"


Reply | Threaded
Open this post in threaded view
|

Re: [Ann] New version of Mocketry 3.0

Sean P. DeNigris
Administrator
Tudor Girba-2 wrote
It is your prerogative :), but “should got" sounds broken :(.
Sounds like fingernails on a chalkboard IMH-native-english-speaker-O ;)
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: [Ann] New version of Mocketry 3.0

stepharo
In reply to this post by Tudor Girba-2


Le 19/4/16 15:46, Tudor Girba a écrit :

> Hi,
>
>> On Apr 6, 2016, at 6:13 AM, Denis Kudriashov <[hidden email]> wrote:
>>
>>
>> 2016-04-06 14:51 GMT+02:00 Tudor Girba <[hidden email]>:
>> Just the English does not sound quite well for statements like:
>>          mock should got someMessage
>>          mock should not got anotherMessage.
>>
>> I know that there was a long discussion about naming these. I do not remember the outcome, but still I think other alternatives would be better:
>>          mock should haveReceived someMessage.
>>          mock should not haveReceived anotherMessage.
>> or even
>>          mock shouldnt haveReceived anotherMessage.
>>
>> You right. There was discussion and I made decision :)
>> Some of people suggest "should got" which is very short version and I like it. I know it is not completely correct from English perspective but it is readable enough and understandable.
> It is your prerogative :), but “should got" sounds broken :(.

+1 :)

>
>> #shouldnt can be good. But usually we not use "should not" assertions. Only when we really want to deny certain condition we write it such way. In that cases full form of "should not" feels better for me.
>> But it is always personal choice. So I made decision. (many my tests uses "should not" :))
> I think “should not" sounds fine like it is.
>
> Cheers,
> Doru
>
>
>
>> I think I would favor:
>>          mock stub someMessage toReturn: 1000.
>> or
>>          mock stub someMessage returns: 1000.
>>
>> What do you think?
>>  
>> Same here.
>> Mocketry is very old and it was always idea of will:. You can also put block for expected action:
>>          mock stub someMessage will: [#yourResult].
>>          (mock stub someMessageWith: Any) will: [:arg | arg + 1].
>>
> --
> www.tudorgirba.com
> www.feenk.com
>
> "What is more important: To be happy, or to make happy?"
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [Ann] New version of Mocketry 3.0

Denis Kudriashov
In reply to this post by Sean P. DeNigris

2016-04-20 2:27 GMT+02:00 Sean P. DeNigris <[hidden email]>:
Tudor Girba-2 wrote
> It is your prerogative :), but “should got" sounds broken :(.

Sounds like fingernails on a chalkboard IMH-native-english-speaker-O ;)

Ok. I open new thread about names
Reply | Threaded
Open this post in threaded view
|

Re: [Ann] New version of Mocketry 3.0

Tudor Girba-2
Thank you!

Doru


> On Apr 20, 2016, at 10:35 AM, Denis Kudriashov <[hidden email]> wrote:
>
>
> 2016-04-20 2:27 GMT+02:00 Sean P. DeNigris <[hidden email]>:
> Tudor Girba-2 wrote
> > It is your prerogative :), but “should got" sounds broken :(.
>
> Sounds like fingernails on a chalkboard IMH-native-english-speaker-O ;)
>
> Ok. I open new thread about names

--
www.tudorgirba.com
www.feenk.com

"It's not how it is, it is how we see it."


Reply | Threaded
Open this post in threaded view
|

Re: [Ann] New version of Mocketry 3.0

Damien Pollet
Hello guys, a feature idea/request…

This weekend I was binge-watching talks from Ruby conferences, by Sandi Metz and Katrina Owen on OO design, refactoring, and testing.
Highly recommended, and at least Sandi is an experienced smalltalker.

In particular, in the second one, Sandi remarks that there is a risk that the application API diverges from the set of messages checked with the mocks. There are tools to help with that, mostly involving the mocks checking that each message they expect actually exists in the application.

In Mocketry, mocks are created ex-nihilo, but it could be nice to pass a reference class to compare with, or for the mock to check that there are implementors of the message.

On 20 April 2016 at 22:54, Tudor Girba <[hidden email]> wrote:
Thank you!

Doru


> On Apr 20, 2016, at 10:35 AM, Denis Kudriashov <[hidden email]> wrote:
>
>
> 2016-04-20 2:27 GMT+02:00 Sean P. DeNigris <[hidden email]>:
> Tudor Girba-2 wrote
> > It is your prerogative :), but “should got" sounds broken :(.
>
> Sounds like fingernails on a chalkboard IMH-native-english-speaker-O ;)
>
> Ok. I open new thread about names

--
www.tudorgirba.com
www.feenk.com

"It's not how it is, it is how we see it."





--
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet