[Kc] Testing Forms

Sterling Hanenkamp sterling at hanenkamp.com
Wed Jan 12 09:51:59 PST 2011

We use Selenium extensively to handle integration testing of our
Perl/JavaScript-based application and it works quite well. You have to spend
some time getting things bootstrapped for your needs, but after that it is
very nice. We started with a test suite like the one you show below, often
recorded using the Selenium IDE. After that we enhanced the system so that
now we have our own natural language layer we use to build tests. (The
natural language allows business analyst to read the tests.)

Selenium testing is valuable for regression testing as well. We can run the
test suite and know with reasonable certainty that new changes to the Perl
code or the JavaScript haven't broken the app in any of the major browsers.
(Or that it has and either a test or the app needs to be fixed.)

In general, when writing web applications, I would recommend writing
internal unit tests to verify that your models and business logic is
correct, but use Selenium or something like it to handle the integration

Unfortunately, I have no practical advice to offer since I'm not the testing
guru and haven't really messed with Selenium myself in 2-3 years. :)

On Wed, Jan 12, 2011 at 11:31 AM, djgoku <djgoku at gmail.com> wrote:

> On Wed, Jan 12, 2011 at 11:17 AM, Doug Sparling <doug.sparling at gmail.com>
> wrote:
> > If you're automating your tests, I'd go with something like the Selenium
> > library. I haven't done much Perl for three or four years, so I can only
> > speak from experience that's non-Perl related. We used Selenium (and
> > Cucumber/Webrat, as at the time I was doing RoR) for automated
> integration
> > testing, testing forms, and TDD/BDD. If it's off the cuff/simple testing,
> > I'd use curl.
> When you used Selenium did you do form testing? I am not sure what all
> needs to be tested.
> I currently have this(Test::WWW::Mechanize):
> $mech->get_ok('http://localhost:3000/form');
> $mech->title_is('AppName', 'Make sure were on the AppName page');
> $mech->submit_form_ok({form_number => 1, fields => { name => 'test'
> }}, 'adding a name worked');
> But if I change submit_form_ok to (the test still passes even though I
> didn't pass in the name field):
> $mech->submit_form_ok({form_number => 1}, 'adding a name shouldn''t work');
> Jonathan
> _______________________________________________
> kc mailing list
> kc at pm.org
> http://mail.pm.org/mailman/listinfo/kc

Andrew Sterling Hanenkamp
sterling at hanenkamp.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/kc/attachments/20110112/4a2e756a/attachment.html>

More information about the kc mailing list