[Bese-devel] automated testing of ucw apps

Marco Baringer mb at bese.it
Fri Jul 22 17:49:37 UTC 2005


Asbjørn Bjørnstad <asbjxrn at bjxrnstad.net> writes:

> Is there a nice easy way of doing automated testing of ucw apps?
> I guess you'd need a testing framework that would handle the
> continuations/sessions.

i think defining your own response object and seperate render-on
methods for each component would go a _long_ way to making it easy to
test ucw apps.

something like this for window components:

(defmethod render-on :before ((res test-response) (w window-component))
  (princ *yaclml-stream*
         (list (session.id (context.session *context*))
               (frame.id (session.current-frame ...)))))

and then you colud use something like this as a generic render-on
method:

(defmethod render-on ((res test-response) (c standard-component))
  (nth-value 1 (make-load-form c nil)))

basically what would this accomplish: every time you sent in a 'test'
request you'd get an easily parsable (READ sholud be enough) object
which describes the current componet without having to worry about
parsing xhtml. the only thing (that i can think of atm) left is a
machine friendly way of outputing the action links, this would allow
you to setup a script which gets a page, inspects the component and
then calls the actions and then makes sure the proper component comes
back. doing this would be a "simple" matter of using a function like
this:

(defmarco <ucw:test-a (&key action)
  (format *yaclml-stream*
          (list :action-link 
                (print-uri-to-string
                 (compute-url *current-component*
                              :action-id (make-new-action (context.current-frame *context*)
                                                          (lambda () ,action)))

again, this isn't fundamentally different than <ucw:a but has the
advantage being READ'able.

other than these "minor" changes to the rendering out i can't think of
anything which could done to make testing ucw apps easier (thoguh
suggestions are welcome).

should you ever write anything and feel like releasing it i'd be vory
vory happy to include it in ucw.

-- 
-Marco
Ring the bells that still can ring.
Forget the perfect offering.
There is a crack in everything.
That's how the light gets in.
	-Leonard Cohen



More information about the bese-devel mailing list