Testing a seaside task and component?

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

Testing a seaside task and component?

abergel
Hi!

I have a rather simple question regarding seaside.
Assuming I have a method MyTask>>go
How can I test it in a unit test?
Executing MyTask new go leads to the error:  'You can only #call: and #answer: from within a callback or a Task.'

Pity the Seaside distribution does not have the Sushi example and some tests.

Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



_______________________________________________
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 seaside task and component?

Johan Brichau-2
Hi Alex,

What exactly do you want to test by executing ‘go’ on the task?

There is the SeasideTesting project that allows to ‘unit test’ components but I am no longer maintaining that one in favour of Parasol.
I think it will even not load anymore in Pharo 4.

Now, you can ‘unit test’ components by making sure some dynamic variables are present when running the test (e.g. request, session, …).
That’s how we converted a bunch of tests written using SeasideTesting to regular unit tests, though I would not recommend that approach when you start writing tests.

Johan


> On 16 May 2015, at 17:12, Alexandre Bergel <[hidden email]> wrote:
>
> Hi!
>
> I have a rather simple question regarding seaside.
> Assuming I have a method MyTask>>go
> How can I test it in a unit test?
> Executing MyTask new go leads to the error:  'You can only #call: and #answer: from within a callback or a Task.'
>
> Pity the Seaside distribution does not have the Sushi example and some tests.
>
> Cheers,
> Alexandre
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
> _______________________________________________
> 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 seaside task and component?

Paul DeBruicker
In reply to this post by abergel
This was a helpful video about testing seaside components using Parasol:


https://www.youtube.com/watch?v=CoJ-Wnno6TY




abergel wrote
Hi!

I have a rather simple question regarding seaside.
Assuming I have a method MyTask>>go
How can I test it in a unit test?
Executing MyTask new go leads to the error:  'You can only #call: and #answer: from within a callback or a Task.'

Pity the Seaside distribution does not have the Sushi example and some tests.

Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside