Hi Cory -- > Thoughts? I'm having trouble thinking of good ways to test > CGI::Applications without resorting to using a browser each I > 'build' them. > > I'm thinking sanity and regression tests with ( as of yet > un-fathomed ) > special hooks for CGI::Application.
CGI.pm (which is an important component of CGI::Application) has capabilities to run via the command line. If you are interested in automated regression testing, I would make use of those capabilities. Take a look at the test.pl which comes with the CGI::Application distribution. This is (basically) what I do to make sure that CGI::Application works. Consider, "Test 8" from the test.pl: # Test 8: run() CGI::Application sub-class, in run-mode 'tmpl_test'. # Expect HTTP header + 'Hello World: tmpl_test'. $ENV{CGI_APP_RETURN_ONLY} = 1; { my $t8_ta_obj = TestApp->new(TMPL_PATH=>'test/templates/'); $t8_ta_obj->query(CGI->new({'test_rm' => 'tmpl_test'})); my $t8_output = $t8_ta_obj->run(); if ( ($t8_output =~ /^Content\-Type\:\ text\/html/) && ($t8_output =~ /\-\-\-\-\>Hello\ World\:\ tmpl\_test\<\-\-\-\-/)) { print "ok 8\n"; } else { print "not ok 8\n"; } } As you can see, I instantiate my app in a particular run-mode by using CGI.pm's ability to create a query object in a particular state. You could do something similar for your apps. I could imagine a system where you would built your site using h2xs and it would have a "make test" facility for regression testing. This is completely possible, if you know the intricacies of ExtUtils::MakeMaker. Let me know if you take this to the next step! It sounds like a cool idea. TTYL, -Jesse- Jesse Erlbaum, CTO Vanguard Media http://www.vm.com 212.242.5317 x115 [EMAIL PROTECTED] --------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/cgiapp@lists.vm.com/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]