[Catalyst] writing a test suite for my app

Matt S Trout dbix-class at trout.me.uk
Fri May 19 21:19:29 CEST 2006


Daniel McBrearty wrote:
> "What he's doing here is simulating hitting your web application without
> actually making any HTTP requests."
> 
> Am I missing the point here ...? What is he doing if not making http 
> requests? Just parsing the code and seeing what the result of such a 
> request *would* be if it were made?

Basically, Catalyst::Test by default lobs an HTTP::Request object at your app 
and gets an HTTP::Response object back, without going to the trouble of the 
whole TCP socket thing. Since it uses HTTP::Request::AsCGI to do this, the 
request parsing/response production is still tested after a fashion, but it's 
primarily there for testing your app logic.

> I guess this is OK in dev, when you are typically running the dev server 
> anyway. So what's best before using the app in anger? make a test 
> deployment and use the env var to test against that?

Absolutely - and you can do that with the main Catalyst tests if you want to 
sanity check a deployment (just load the TestApp into your staging environment).

Always do QA on as close to a replica of the production environment as humanly 
possible - but also remember that this is for the integration testing stage; 
unit and functional testing can quite happily happen without this and you 
don't need to introduce the overhead and complexity until you get that far.

> BTW I filed a ticket saying what I think is happening.
> 
> http://rt.cpan.org/Public/Bug/Display.html?id=19361
> 
> If you talk with him you could ask what he thinks, Matt.

Will do, but right now it's friday evening so I'd suspect he's down the pub :)

-- 
      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list