[html-formfu] Standalone testing with FormFu

Carl Franks fireartist at gmail.com
Mon Sep 24 09:25:50 GMT 2007


On 24/09/2007, Thomas L. Shinnick <tshinnic at io.com> wrote:
>
>  Still playing with the vertically-aligned example and trying out various
> features, including the validation constraints and error messages.  But how
> to test the input error checking without lots of code or embedding into
> another program?
>
>  It is possible to feed sample input values into FormFu using the YAML
> config file.  At the end of my FormFu .yml I added
>
>  query:
>      contact_phone: testing
>      contact_email: tshinnic at gmail.com
>
>  to set the form's 'input' values.
>
>  I had tried to use the "process:" key as documented, but because the config
> loading is still going on process() really can't, uh, process yet.  So to
> force 'input' processing to test constraints and all, I simply added a
> process() call to the short demo program.
>      my $form = HTML::FormFu->new;
>      $form->load_config_file('uw1.yml');
>      $form->process;
>
>      my $tt = Template->new;
>      $tt->process(
>          'uw1.tt',
>          { form => $form },
>          'uw1.html',
>      ) || die $tt->error;
>
>  I can feed bad values in, or leave some required values missing, and
> generally try out lots of combinations of errors, all without much coding.
> Just being lazy...

I would never have thought of setting 'query' in the config file -
that's a good solution.

I hope to get the tuits soon to update my css-tester app [1], so that
you can also use it to build your own forms, adding elements and
constraints, etc.
Then you could just enter whatever input you want directly into the form.

Up until now, I've generally used Catalyst to create a basic
application to test things.

[1] http://www.fireartist.com/html-formfu-cssapp
(though this url will be going 404 soon, as I change my host - I'll
send an update when I get it working again on my new host)

Carl



More information about the HTML-FormFu mailing list