Tuesday, September 25, 2007

two ways to write test cases for Catalyst App

one is using Test::WWW::Mechanize::Catalyst. as recommended in Catalyst::Manual::Tutorial::Testing.

the other way is using MyApp to get $c. like here:
http://lists.scsys.co.uk/pipermail/catalyst/2007-April/012926.html

my $controller = MyApp->controller('MyController');
my $c = MyApp->prepare();

# Monkey with $c to set up a fake context (set req->uri, or params)

my $result = $controller->method_to_test($c, @args);


Enjoy!

Labels: