[Seaside] Seaside and SUnit

Alain Fischer alain.fischer@bluewin.ch
Thu, 4 Apr 2002 21:32:38 +0200


Hi Avi,

I want now to see how I can use SUnit with Seaside component and=20
searching
this mailinglist, I have found that you have already done some work.

I will be very happy if you could share your Seaside testing kit.

Have a nice day.
Alain

PS to Alexandre:
Welcome to Seaside it's a funny technology, full of promise.


Le Mardi 5 mars 2002, =E0 10:35 , Avi Bryant a =E9crit :

> Yes, that would be cool.  Presumably in Seaside you could do something
> with the existing sea:id - it would be trivial to write a macro that
> inserted a testid based on this (we've been thinking about doing
> something similar for CSS support, incidentally, although I haven't
> thought much yet about where you'd want to insert an "id" by default,
> where a "class", etc).
>
> The other problem with tools like HttpUnit, though, is that they seem =
to
> assume you have meaningful (and thus predictable) URLs.  Testing a=20
> Seaside
> application would require a testing framework that could extract the=20=

> urls
> from the current page and use them to test the next one.  Chalk up=20
> another
> point for statelessness, I'm afraid...
>
> In terms of higher level testing, I experimented with a simple system =
to
> let you interact directly with the page instances, avoiding all the =
HTML
> and HTTP stuff.  Each request is simulated within a "self go: [...]"
> block, and the TestCase object makes sure that a "page" instVar is=20
> always
> set to the current page.  So, an simple test for the calculator =
example
> might look like
>
> self go: [page numberPressed: 1].
> self go: [page numberPressed: 0].
> self assert: page current =3D '10'.
> self go: [page enter].
> self assert: page stack first =3D 10.
> self go: [page current: '20'. page functionPressed: #+].
> self assert: page stack first =3D 30.
>
> I didn't include this code in the release because, due to a strange
> interaction between #ensure: and #callCC:, I had to modify SUnit=20
> slightly
> to get it to work and I haven't tested it enough to be certain I =
didn't
> break anything.  If anyone wants it, I can bring it up to date and =
post
> it.