[Catalyst] testing framework

Carl Franks fireartist at gmail.com
Thu Mar 2 18:06:52 CET 2006


Hi,

I used CGI-Prototype for a fairly large project last year, and fell
for CGI-Prototype-Mecha!

It provides an object for use in your test.t files which is a
sub-class of WWW-Mechanize, this automatically provides all of
WWW-Mechanize's goodness, such as the methods
title(), links(), forms()
and the abillity to fill-in forms, submit them, and check the reponse.

I'm needing something like this for my current project, and while I'm
at it, would be interested in either trying to modify Catalyst::Test
(providing backwards compatability), or creating a new test module and
changing the generated test.t files, so they use that instead.

Does anyone else like the idea of getting WWW-Mechanize's
functionality in the test suite?
Does anyone have any better suggestions for how to integrate it into
catalyst, while maintaining backwards compatability?

My motivation for this is largely related to my "url handling seems
wrong" email earlier today.
When I know my test suite is searching pages for links and following
them, searching for forms, filling them in, and I can check the
reponse body that the right thing has happened, _then_ I can get a
warm fuzzy feeling.

Up 'til now with this catalyst app, all the tests were passing.
Then I changed the homepage (myapp.pm's default sub) to a redirect.
I changed my 01app.t to test is_redirect() instead of is_success(),
ran the test suite and discovered that *all* the controllers were
failing tests because instead of fetching "/a/page" they were fetching
"a/page", and unknown to me were actually all being caught by the
'homepage' controller.
No warm fuzzy feeling.

I hope I don't come over as being too negative, because I'm really
enjoying developing with catalyst, and really apppreciate it, however
it is a major bummer to find out that the test suite was really
testing nothing other than the homepage :(

Cheers,
Carl



More information about the Catalyst mailing list