Possible Duplicate:
Integration Testing for a Web App
I've recently delved into Perl and I'd like to learn how to automate web site testing. To that end I'd appreciate answers to the following:
- What modules from CPAN should I look into? Is there something simi开发者_StackOverflow社区lar to Watir (I know there's a Windows only port of it in Perl)?
- I'm using a Windows system, so does it matter if I use ActivePerl or Strawberry Perl?
- What books should I look into (aside from "Perl Testing: A Developer's Notebook")?
Edit:
- The web application is written in Java
- I want to test the application's web GUI, which makes use of javascript/ajax & some flex/flash
WWW::Mechanize
,WWW::Selenium
andLWP::Simple
just to name a few.ActivePerl is more user friendly than Strawberry when it comes to downloading CPAN modules, but at the end of the day they are both equally as good.
I haven't come across any books on the subject; perhaps a tutorial is what you need.
Are you interested testing the WEB GUI itself via http calls or individual Perl modules via calling Perl code directly?
For the former, Selenium - which AFAIK is not Perl specific at all - seems to be the accepted Best Practice (see Integration Testing for a Web App link helpfully provided by Ether ). It has a Perl CPAN module for integration, mentioned in the same SO question.
You can of course do your own testing frameworks, e.g. implement http calls via WWW::Mechanize
. But that would not work with JavaScript-enabled web sites (are there any left that aren't?) since you need a JavaScript engine, either provided by the browser (Selenium's approach) or something embedded which AFAIK Perl doesn't actually have, though Java does.
However, there are non-http approaches to testing Perl side code of the web apps as well:
Have all non-presentation logic nicely modularized away, and test it as usual using Test::More or your other favorite test frameworks.
Test presentation (or presentation+logic) by using your web framework in command line mode, emulating running on web server. CGI.pm allows that, as well as EmbPerl. Not sure about Catalyst apps.
精彩评论