Mocketry names again

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

Mocketry names again

Denis Kudriashov
Hi.

People start argue that my choice of names are not good.

For now Mocketry use "should got" to verify that following message was occurred:

mock should got someMessage

This is broken for native english speakers. Do you agree to replace it with correct #haveReceived? 
Can we use more short version #haveGot?

mock should haveReceived someMessage
mock should haveGot someMessage

Also there is new expression to verify how object was received during test: 

result should beReturnedFrom: [mock someMessage]

Should it be #haveReturnedFrom: ?

result should haveReturnedFrom: [mock someMessage]

I hope we can make consensus and be happy with Mocketry.

Best regards,
Denis
Reply | Threaded
Open this post in threaded view
|

Re: Mocketry names again

Dennis Schetinin
Why do we need those sophisticated past-something form after should at all? Why not simply
mock should receive someMessage
?




--

Best regards,


Dennis Schetinin


2016-04-20 11:35 GMT+03:00 Denis Kudriashov <[hidden email]>:
Hi.

People start argue that my choice of names are not good.

For now Mocketry use "should got" to verify that following message was occurred:

mock should got someMessage

This is broken for native english speakers. Do you agree to replace it with correct #haveReceived? 
Can we use more short version #haveGot?

mock should haveReceived someMessage
mock should haveGot someMessage

Also there is new expression to verify how object was received during test: 

result should beReturnedFrom: [mock someMessage]

Should it be #haveReturnedFrom: ?

result should haveReturnedFrom: [mock someMessage]

I hope we can make consensus and be happy with Mocketry.

Best regards,
Denis

Reply | Threaded
Open this post in threaded view
|

Re: Mocketry names again

Denis Kudriashov

2016-04-20 13:59 GMT+02:00 Dennis Schetinin <[hidden email]>:
Why do we need those sophisticated past-something form after should at all? Why not simply
mock should receive someMessage
?

Maybe. What others think?
Reply | Threaded
Open this post in threaded view
|

Re: Mocketry names again

S Krish
+1.

this is easy and simple for any native / non native english ..

Mocketry is really nice btw..

On Wed, Apr 20, 2016 at 7:45 AM, Denis Kudriashov <[hidden email]> wrote:

2016-04-20 13:59 GMT+02:00 Dennis Schetinin <[hidden email]>:
Why do we need those sophisticated past-something form after should at all? Why not simply
mock should receive someMessage
?

Maybe. What others think?

Reply | Threaded
Open this post in threaded view
|

Re: Mocketry names again

S Krish


result should return: [mock someMessage]





On Wed, Apr 20, 2016 at 1:35 PM, S Krish <[hidden email]> wrote:
+1.

this is easy and simple for any native / non native english ..

Mocketry is really nice btw..

On Wed, Apr 20, 2016 at 7:45 AM, Denis Kudriashov <[hidden email]> wrote:

2016-04-20 13:59 GMT+02:00 Dennis Schetinin <[hidden email]>:
Why do we need those sophisticated past-something form after should at all? Why not simply
mock should receive someMessage
?

Maybe. What others think?


Reply | Threaded
Open this post in threaded view
|

Re: Mocketry names again

Denis Kudriashov

2016-04-20 20:36 GMT+02:00 S Krish <[hidden email]>:
result should return: [mock someMessage]

It should verify that result was returned from message defined inside block. That's why I use  "should beReturnedFrom: [mock someMessage]". Following test demonstrates idea:

mock := Mock new.
mock stub someMessage willReturn: #result.
mock stub anotherMessage willReturn: #anotherResult.

mock someMessage should be: #result.
mock anotherMessage should be: #anotherResult.

#result should beReturnedFrom: [mock someMessage].
#result should not beReturnedFrom: [mock anotherMessage]

Reply | Threaded
Open this post in threaded view
|

Re: Mocketry names again

Sean P. DeNigris
Administrator
In reply to this post by Denis Kudriashov
Denis Kudriashov wrote
Can we use more short version #haveGot?
...
mock should haveGot someMessage
No ;) The minimum to not sound terrible would be #haveGotten

Denis Kudriashov wrote
beReturnedFrom:... Should it be #haveReturnedFrom:
This one seems less crucial. #have... would technically be correct since you made the others in the past tense, but as other commenters have pointed out, it would simplify things to keep everything in the present tense. Although there would then be the mismatch with the fact that the things did in fact already happen  (hopefully) in the past!
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Mocketry names again

Carlos Lombardi
In reply to this post by Denis Kudriashov
... maybe 

#result should beTheResultOf: [mock someMessage].
#result should not beTheResultOf: [mock anotherMessage].

Cordially - Carlos

On Wed, Apr 20, 2016 at 9:22 PM, Denis Kudriashov <[hidden email]> wrote:

2016-04-20 20:36 GMT+02:00 S Krish <[hidden email]>:
result should return: [mock someMessage]

It should verify that result was returned from message defined inside block. That's why I use  "should beReturnedFrom: [mock someMessage]". Following test demonstrates idea:

mock := Mock new.
mock stub someMessage willReturn: #result.
mock stub anotherMessage willReturn: #anotherResult.

mock someMessage should be: #result.
mock anotherMessage should be: #anotherResult.

#result should beReturnedFrom: [mock someMessage].
#result should not beReturnedFrom: [mock anotherMessage]


Reply | Threaded
Open this post in threaded view
|

Re: Mocketry names again

Denis Kudriashov

2016-04-27 0:33 GMT+02:00 Carlos Lombardi <[hidden email]>:
... maybe 

#result should beTheResultOf: [mock someMessage].
#result should not beTheResultOf: [mock anotherMessage].

It's nice.I think "The" can be omitted:

#result should beResultOf: [mock someMessage].

But anyway I use word #return because there are different types of result: value return and error signal. There is no expression for last case but it would be like:

anError should beRaisedBy: [mock someMessage]
Reply | Threaded
Open this post in threaded view
|

Re: Mocketry names again

Carlos Lombardi
Hi again,

ok, just to have coherence between the names for the two possible outcomes of a method, you could use #beReturnedBy instead of #beReturnedFrom: . You would have #beReturnedBy:  and  #beRaisedBy: 

On Wed, Apr 27, 2016 at 10:00 AM, Denis Kudriashov <[hidden email]> wrote:

2016-04-27 0:33 GMT+02:00 Carlos Lombardi <[hidden email]>:
... maybe 

#result should beTheResultOf: [mock someMessage].
#result should not beTheResultOf: [mock anotherMessage].

It's nice.I think "The" can be omitted:

#result should beResultOf: [mock someMessage].

But anyway I use word #return because there are different types of result: value return and error signal. There is no expression for last case but it would be like:

anError should beRaisedBy: [mock someMessage]

Reply | Threaded
Open this post in threaded view
|

Re: Mocketry names again

Denis Kudriashov
So at the end of week I will rename "should got" into "should receive"

2016-04-27 23:39 GMT+02:00 Carlos Lombardi <[hidden email]>:
Hi again,

ok, just to have coherence between the names for the two possible outcomes of a method, you could use #beReturnedBy instead of #beReturnedFrom: . You would have #beReturnedBy:  and  #beRaisedBy: 

On Wed, Apr 27, 2016 at 10:00 AM, Denis Kudriashov <[hidden email]> wrote:

2016-04-27 0:33 GMT+02:00 Carlos Lombardi <[hidden email]>:
... maybe 

#result should beTheResultOf: [mock someMessage].
#result should not beTheResultOf: [mock anotherMessage].

It's nice.I think "The" can be omitted:

#result should beResultOf: [mock someMessage].

But anyway I use word #return because there are different types of result: value return and error signal. There is no expression for last case but it would be like:

anError should beRaisedBy: [mock someMessage]


Reply | Threaded
Open this post in threaded view
|

Re: Mocketry names again

Denis Kudriashov
And done. Version 3.4 deprecates "should got" and introduces "should receive".
All docs are updated.


2016-05-18 11:59 GMT+02:00 Denis Kudriashov <[hidden email]>:
So at the end of week I will rename "should got" into "should receive"

2016-04-27 23:39 GMT+02:00 Carlos Lombardi <[hidden email]>:
Hi again,

ok, just to have coherence between the names for the two possible outcomes of a method, you could use #beReturnedBy instead of #beReturnedFrom: . You would have #beReturnedBy:  and  #beRaisedBy: 

On Wed, Apr 27, 2016 at 10:00 AM, Denis Kudriashov <[hidden email]> wrote:

2016-04-27 0:33 GMT+02:00 Carlos Lombardi <[hidden email]>:
... maybe 

#result should beTheResultOf: [mock someMessage].
#result should not beTheResultOf: [mock anotherMessage].

It's nice.I think "The" can be omitted:

#result should beResultOf: [mock someMessage].

But anyway I use word #return because there are different types of result: value return and error signal. There is no expression for last case but it would be like:

anError should beRaisedBy: [mock someMessage]



Reply | Threaded
Open this post in threaded view
|

Re: Mocketry names again

Tudor Girba-2
Yuppee! Thanks :)

Doru


> On May 23, 2016, at 12:18 PM, Denis Kudriashov <[hidden email]> wrote:
>
> And done. Version 3.4 deprecates "should got" and introduces "should receive".
> All docs are updated.
>
> Prebuilt PDF can found here https://ci.inria.fr/pharo-contribution/view/Books/job/PharoBookWorkInProgress/107/artifact/book-result/Mocketry/Mocketry.pdf
>
> 2016-05-18 11:59 GMT+02:00 Denis Kudriashov <[hidden email]>:
> So at the end of week I will rename "should got" into "should receive"
>
> 2016-04-27 23:39 GMT+02:00 Carlos Lombardi <[hidden email]>:
> Hi again,
>
> ok, just to have coherence between the names for the two possible outcomes of a method, you could use #beReturnedBy instead of #beReturnedFrom: . You would have #beReturnedBy:  and  #beRaisedBy:
>
> On Wed, Apr 27, 2016 at 10:00 AM, Denis Kudriashov <[hidden email]> wrote:
>
> 2016-04-27 0:33 GMT+02:00 Carlos Lombardi <[hidden email]>:
> ... maybe
>
> #result should beTheResultOf: [mock someMessage].
> #result should not beTheResultOf: [mock anotherMessage].
>
> It's nice.I think "The" can be omitted:
>
> #result should beResultOf: [mock someMessage].
>
> But anyway I use word #return because there are different types of result: value return and error signal. There is no expression for last case but it would be like:
>
> anError should beRaisedBy: [mock someMessage]
>
>
>

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

"Speaking louder won't make the point worthier."