Mike Tonks wrote:

Can anyone recommend a method or point me to some examples for testing
CGI::App run modes?

For basic tests you can just instantiate your classes, call run and get the output using the CGI_APP_RETURN_ONLY environment variable. Then you can use things like Test::HTML::Content to make sure it looks like what you want.

But this only really works for light testing. If you really want to make sure your application works you should test it using the same web server you're going to use in production. And then you can test it just like any other web app with Test::WWW::Mechanize and friends.

Our app is getting ever more complex and could really do with some
automated tests.  I'm able to build tests against the MCV 'model'
classes, but not the controllers or views (never mind the ajax!).

Ajax is trickier. Do you just want to test that your server returns the right things in Ajax mode? It's pretty easy to use Mechanize to test things like HTML snippets and JSON. But it gets more difficult if you actually want to run your Javascript. For that you'll need something like Selenium or Windmill.

--
Michael Peters
Plus Three, LP


#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################

Reply via email to