From grail at goldweb.com.au Thu Dec 9 17:11:48 2010 From: grail at goldweb.com.au (Alex Satrapa) Date: Fri, 10 Dec 2010 12:11:48 +1100 Subject: [Canberra-pm] Testing HTML::Mason web application workflows Message-ID: Dear Mongers, I'm currently playing around with HTML::Mason::Test which lets me test individual templates in what are effectively unit tests. My Google-fu is obviously weak, I cannot find anything about integration/workflow testing. On one hand, I could use Test::WWW::Mechanize. The catch with this approach is that I'll need to set up a web server - not something I really want to do in my test suite since I don't want to have "install Apache" as a prerequisite for being able to develop the application (the developer might have a fondness for some other web server). Under Ruby on Rails and Django, the test suites provide the ability to mimic HTTP calls, instead invoking the template engine directly. In the test suite I can instruct the test engine to fill in certain fields with certain values, "submit" that form to the mock HTTP service (which is just a shim covering the Rails or Django libraries), with no need to set up an actual web server launching CGI scripts or WSGI or what not. My current test suites run in the order of 15 seconds for 403 tests. I want to avoid network or disk operations where at all possible. Is such an environment available for testing HTML::Mason applications? I'd like this to be pure Perl as far as possible. Alex From megamic at gmail.com Fri Dec 10 13:56:48 2010 From: megamic at gmail.com (Michael Potter) Date: Sat, 11 Dec 2010 08:56:48 +1100 Subject: [Canberra-pm] Canberra-pm Digest, Vol 63, Issue 1 In-Reply-To: References: Message-ID: On Sat, Dec 11, 2010 at 7:00 AM, wrote: > Send Canberra-pm mailing list submissions to > canberra-pm at pm.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.pm.org/mailman/listinfo/canberra-pm > or, via email, send a message with subject or body 'help' to > canberra-pm-request at pm.org > > You can reach the person managing the list at > canberra-pm-owner at pm.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Canberra-pm digest..." > > > Today's Topics: > > 1. Testing HTML::Mason web application workflows (Alex Satrapa) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Fri, 10 Dec 2010 12:11:48 +1100 > From: Alex Satrapa > Subject: [Canberra-pm] Testing HTML::Mason web application workflows > To: canberra-pm at pm.org > Message-ID: > Content-Type: text/plain; charset=us-ascii > > Dear Mongers, > > I'm currently playing around with HTML::Mason::Test which lets me test > individual templates in what are effectively unit tests. > > My Google-fu is obviously weak, I cannot find anything about > integration/workflow testing. > > On one hand, I could use Test::WWW::Mechanize. The catch with this approach > is that I'll need to set up a web server - not something I really want to do > in my test suite since I don't want to have "install Apache" as a prerequisite for being able to develop the application (the developer > might have a fondness for some other web server). > You may want to consider PSGI (Plack). It comes with a Perl webserver out of the box for testing, is web-server agnostic, and is generally a great environment to develop web apps in. There is an adapter for HTML::Mason: http://search.cpan.org/~abh/HTML-Mason-PSGIHandler-0.52/lib/HTML/Mason/PSGIHandler.pm > > Under Ruby on Rails and Django, the test suites provide the ability to > mimic HTTP calls, instead invoking the template engine directly. In the test > suite I can instruct the test engine to fill in certain fields with certain > values, "submit" that form to the mock HTTP service (which is just a shim > covering the Rails or Django libraries), with no need to set up an actual > web server launching CGI scripts or WSGI or what not. > > My current test suites run in the order of 15 seconds for 403 tests. I want > to avoid network or disk operations where at all possible. > > Is such an environment available for testing HTML::Mason applications? I'd > like this to be pure Perl as far as possible. > I believe Plack::Test allows for this when using the MockHTTP backend: http://search.cpan.org/~miyagawa/Plack-0.9956/lib/Plack/Test.pm > > Alex > > > > ------------------------------ > > _______________________________________________ > Canberra-pm mailing list > Canberra-pm at pm.org > http://mail.pm.org/mailman/listinfo/canberra-pm > > End of Canberra-pm Digest, Vol 63, Issue 1 > ****************************************** > -------------- next part -------------- An HTML attachment was scrubbed... URL: