Apache session data eruptions for unit testing

I work with a web application that usually runs in mod_perl under Apache. The employee and I are trying to perform some unit tests. Are there any good tools or methods for conducting sessions and requests, etc. that can help us implement this code outside the context of a web server?

+7
source share
1 answer

If you use mod_perl 1, there is Apache :: FakeRequest , which comes with mod_perl. This is not a complete layout of the request object, so you need to add some of your methods. Even if your code uses Apache :: Request . Even more for cookies and downloads. Basically you are going to spend a lot of time with Test :: MockObject . Fortunately, Apache's interfaces are pretty simple.

If at all possible, you should consider switching to the Plack framework (Catalyst, Dancer , etc.), which provide much more reliable testing and debugging tools. If you use mod_perl2, you're in luck! It is easy (relative to mod_perl 1) to wrap a mod_perl2 application with Plack. Plack :: App :: FakeApache does most of the work for you. Here is a discussion outlining various methods and benefits.

+3
source

All Articles