-----Original Message----- From: Patton, Billy [mailto:billy.pat...@h3net.com] Sent: Tuesday, October 07, 2014 6:24 AM To: modperl@perl.apache.org Subject: beginning and testing
I'm rewriting/moving an app that hasn't been touched in over 5 years. The original developers have since left the company. It's all written in CGI/OOPerl. It seems as though the original developers applied the OOW-AHH , look at what I can do, instead of KISS. Simply put they needed a skateboard but built a space shuttle. So I'm task with taking this Hydra/Medusa cross and converting it to KISS(Keep It Simple Stupid) So I'm going to us mod_perl. I will be able to use some of their logic and code. At my previous job we had a mantra "design for test" So from the very first file I create I want to be able to test each step as I proceed. I've used, very simply, the .t files for test my library and my apps that run from the command line but never some thing from the web. In the past I've used an Oracle product that does web testing, but that's rather expensive. So have no doubts that Apache and mod_perl have an enormous testing suite available for testing my perl and the web site it creates. IE : Apache:TestRun, Apache::TestRunPerl When I do apropos Apache | grep -i test I get 14 Apache::Test* modules and one Bundle::ApacheTest module. So I'm looking for a start point. There is a lot of information, too much for me to digest. My web app will consist of forms with h-links to another page and some drop downs. A few "enter text" widgets. I'm beginning to believe that testing in Apache is a completely difference world than testing from the command line, as it should be. I'm just not sure where to start. Any recommendations would help. ------------------------------------- I have found Apache::Test extremely useful for testing web applications. Don't let anyone tell you to run manual tests, that is a recipe for confusion and error as you try to modify code later. A good place to start is the test structure for mod_perl itself, but all the bells and whistles they use are probably more than you need. Also, I use Module::Build instead of ExtUtils::MakeMaker. Follow the instructions for a Module::Build Build.PL file, but make your builder object an Apache::TestMB or subclass of that. (It is a subclass of Module::Build.) Then you want to start with the files t/conf/extra.last.conf.in and t/conf/modperl_extra.pl. extra.last.conf.in contains Apache directives and VirtualHost sections that you want to run. modperl_extra.pl will be executed by Apache startup. When you do `./Build test`, it will generate t/TEST, start up Apache2 with your settings on a localhost port, then you can use LWP and start implementing tests. I sometimes add a testing environment variable which causes my apache handlers to add extra results in an X- header to check in the test script. You can also write t/TEST.PL, which gets added to the generated t/TEST script. It has to run: use Apache::TestRunPerl (); Apache::TestRunPerl->new->run(@ARGV); ... at the end, since this does not seem to get added to the generated t/TEST script when t/TEST.PL is used. HTH. Mark