|more useful options|
Apache mod_perl: Test driven developent?by chrestomanci (Priest)
|on Jul 17, 2012 at 13:58 UTC||Need Help??|
chrestomanci has asked for the
wisdom of the Perl Monks concerning the following question:
Greetings wise brothers.
I am looking to develop a simple mod_perl application that will eventually run under Apache2, however I would like to develop the logic and flow of my application first without the complexity of running it inside Apache. I would also like to use the perl debugger to step from the test script into my mod_perl application.
I was hoping to develop the application via test driven development, so I could write something like:
Unfortunately, I can't find a test harness that will allow me to test as I have described above. This surprises me as I have done similar testing in the past with Catalyst::Test and it has worked very nicely.
I first investigated Apache2::FakeRequest, and found that while it can create working mock requests, the response body does not get captured, but goes to stdout. The headers appear to go missing entirely.
I also investigated Test::Apache2. Version 2.05 would not build on my Linux box (Ubuntu Oneiric, x86_64), Version 2.04 did build and install, but then broke when my test application called $r->content_type('text/plain'), which is straight from the mod_perl fast start documentation.
I took a look at Apache::Test, but it looks complex to setup, and it is not clear if it is possible to use the perl debugger in any useful way. I also considered not using and mod_perl specific test harness and just using LWP in my test script, and point it to the real web server, but again there would be no way to use the perl debugger.
Am I missing something, or is there realy no simple way to test a mod_perl application?