(reposted to mason-users in hopes of getting more comments)

We have a great deal of poorly-tested Mason code.

I've recently been using Catalyst some, and grown jealous of the testing
tools available.  Specifically, Catalyst::Test and
Test::WWW::Mechanize::Catalyst.

Catalyst::Test takes the name of a Catalyst application and gives you a
simple API to make in-process requests (HTTP::Request and
HTTP::Response).  Test::WWW::Mechanize::Catalyst wraps that with a
Test::WWW::Mech subclass.  Both of them fake requests to
http://localhost/, but can run the exact same tests against a real
server based on an environment variable.

This is much better than the solutions I had encountered before, which
were things like using WWW::Mech on a development server or maybe on a
temporary testing webserver instance (HTTP::Server::Simple).
Devel::Cover works, tests are less complicated, flexibility for both
local and remote, etc.  There are probably some people for whom this is
old hat, but it was new to me.

I talked to Dave Rolsky about this at YAPC and he said that he didn't
know of anything similar for Mason, so I'm thinking of trying to write
it.

A good deal of the work for this has already been done.  I wrote a
module (unreleased) that further abstracts the concept of a mason "site"
(lots of configuration from YAML) and works with either
HTTP::Server::Simple::Mason (well, technically any CGI) or Apache, and
I'm sure I could pick MasonX::WebApp's brains too (or give it some of
mine).  The problems are mostly ones of interface and convention.

1) Catalyst has a clear idea of what an 'application' is.  Does Mason?
   I'm not sure of the common usage, just our internal (and potentially
   pathological) one, where we were still using a handler.pl up until a
   few months ago :( This affects how to invoke the test module --
   Catalyst does 'use Catalyst::Test "My::App"', and something
   reasonably close to as simple would be nice.

2) Even if Mason has a common usage, does it have one that can use
   either ApacheHandler or CGIHandler as necessary depending on the
   context?  This might be a big problem, because it's much easier to
   get people to use a testing module they don't have to change their
   other code to accommodate.

3) Mason has a lot more things that you might want to potentially
   override for testing, especially when it comes to components.
   Catalyst effectively has the concept of a single comp_root, while
   when using Mason you may have 5 of them, 3 of which change (in
   different ways) for testing.

4) I'm not sure how well switching back and forth between
   http://localhost/ and a remote server will work in terms of URL
   handling.  I can't think of a specific problem, but it seems like an
   area where gotchas could easily crop up.

5) ??? Other stuff I haven't thought of yet.

Would anyone else be interested in this sort of thing, even if some
changes to existing code were required in order to use it?  Alternately,
is there something that fills this niche already that I'm not aware of?

hdp.

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to