Adding Actions to a Catalyst app at testing time

In response to a question I posted on the Catalyst list, Tomas Doran (among other suggestions) posted a beautifully devious way to add additional capabilites to your application for test purposes.

When you’re testing with Catalyst::Test and running a local test, you don’t actually fire up a web server and talk over the wire.  It loads your program’s library in to the test script, and calls the functions with the same objects given to it by the other servers.

Your Cat app runs, but all as functions in your program.

Since this is your program – and a test script is just a funny Perl program – you can load libraries and add additional things to the namespace.

Leave a Reply