Testing a callback (no fuctional test)

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

Testing a callback (no fuctional test)

Dave
Hi,
 It's not really clear to me how to test a callback without interact with a browser or tool like selenium, watir etc. etc

Let's take an example from the Seaside book:

AnchorCallbackExample>>renderContentOn: html
 html text: count.
 html break.
 html anchor
 callback: [ self anchorClicked ];
  with: 'click to increment'

How can I trigger the callback via unit test?
Thanks
 Davide
Reply | Threaded
Open this post in threaded view
|

Re: Testing a callback (no fuctional test)

Philippe Marschall
On Fri, Apr 27, 2012 at 10:00 AM, Davide <[hidden email]> wrote:

> Hi,
>  It's not really clear to me how to test a callback without interact with a
> browser or tool like selenium, watir etc. etc
>
> Let's take an example from the Seaside book:
>
> AnchorCallbackExample>>renderContentOn: html
>  html text: count.
>  html break.
>  html anchor
>  callback: [ self anchorClicked ];
>  with: 'click to increment'
>
> How can I trigger the callback via unit test?

AnchorCallbackExample new anchorClicked

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Testing a callback (no fuctional test)

Dave
Philippe Marschall wrote

AnchorCallbackExample new anchorClicked

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Hmm you are not triggering the callback, you are sending a message to AnchorCallbackExample.
What I'm wondering is about a way to work with the WACallbackRegistry (even if I don't want to simulate e request)

Cheers
 Davide
Reply | Threaded
Open this post in threaded view
|

Re: Testing a callback (no functional test)

Dave
typo: (even if I don't want to simulate a request)
Reply | Threaded
Open this post in threaded view
|

Re: Testing a callback (no fuctional test)

Lukas Renggli
In reply to this post by Dave
+1 for Philippe's answer.

You do not want to test the Seaside callback mechanism, do you? This is already tested in functional and unit tests.

Lukas

On Friday, April 27, 2012, Davide wrote:

Philippe Marschall wrote
>
>
>
> AnchorCallbackExample new anchorClicked
>
> Cheers
> Philippe
> _______________________________________________
> seaside mailing list
> seaside@.squeakfoundation
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>

Hmm you are not triggering the callback, you are sending a message to
AnchorCallbackExample.
What I'm wondering is about a way to work with the WACallbackRegistry (even
if I don't want to simulate e request)

Cheers
 Davide

--
View this message in context: http://forum.world.st/Testing-a-callback-no-fuctional-test-tp4592036p4592783.html
Sent from the Seaside General mailing list archive at Nabble.com.
_______________________________________________
seaside mailing list
<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;seaside@lists.squeakfoundation.org&#39;)">seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


--
Lukas Renggli (mobile)
http://www.lukas-renggli.ch

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Testing a callback (no functional test)

Dave
Lukas Renggli wrote
+1 for Philippe's answer.

You do not want to test the Seaside callback mechanism, do you? This is
already tested in functional and unit tests.

Lukas
I see. The reason behind my thoughts is I'd like to reduce feedback of the correctness of my code without waiting for an interaction with a browser or a functional test.

Let's take another simple example from your book:

WebCounter>>renderContentOn: html
html heading: count.
html anchor
callback: [ self increase ];
with: '++'.
....

And let's suppose I already tested "increase" and "decrease".
Unfortunately by mistake, I change the code this way:

WebCounter>>renderContentOn: html
html heading: count.
html anchor
callback: [ self decrease ];
with: '++'.
....

I cannot realize the error until I run some functional tests. That's why I prefer to have a warning of my mistakes early in my development flow.
Cheers
 Davide
Reply | Threaded
Open this post in threaded view
|

Re: Testing a callback (no functional test)

Lukas Renggli
On 30 April 2012 15:56, Dav <[hidden email]> wrote:

>
> Lukas Renggli wrote
>>
>> +1 for Philippe's answer.
>>
>> You do not want to test the Seaside callback mechanism, do you? This is
>> already tested in functional and unit tests.
>>
>> Lukas
>>
>
> I see. The reason behind my thoughts is I'd like to reduce feedback of the
> correctness of my code without waiting for an interaction with a browser or
> a functional test.
>
> Let's take another simple example from your book:
>
> WebCounter>>renderContentOn: html
> html heading: count.
> html anchor
> callback: [ self increase ];
> with: '++'.
> ....
>
> And let's suppose I already tested "increase" and "decrease".
> Unfortunately by mistake, I change the code this way:
>
> WebCounter>>renderContentOn: html
> html heading: count.
> html anchor
> callback: [ self decrease ];
> with: '++'.
> ....
>
> I cannot realize the error until I run some functional tests. That's why I
> prefer to have a warning of my mistakes early in my development flow.

Understood. Seaside has no built-in support for such tests. There are
however various projects that provide (or provided) such
functionality. You might want to try WebTester
(http://www.squeaksource.com/WebTester.html). Not sure how well it
works with recent versions of Seaside?

Lukas

--
Lukas Renggli
www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Testing a callback (no functional test)

Dave
Hi Lukas,
 The Webtester page says it use selenium, that conforms it in the functional test category.
Anyway, thanks for help.
Cheers
 Davide

Understood. Seaside has no built-in support for such tests. There are
however various projects that provide (or provided) such
functionality. You might want to try WebTester
(http://www.squeaksource.com/WebTester.html). Not sure how well it
works with recent versions of Seaside?

Lukas

--
Lukas Renggli
www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Testing a callback (no functional test)

mozillanerd
Would it suffice for you in your test case to send the #value message to the block?