开发者

How can I automate website testing with Perl? [duplicate]

开发者 https://www.devze.com 2023-01-21 17:16 出处:网络
This question already has answers here: Closed 12 years ago. Possible Duplicate: Integration Testing for a Web App
This question already has answers here: Closed 12 years ago.

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:

  1. 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)?
  2. I'm using a Windows system, so does it matter if I use ActivePerl or Strawberry Perl?
  3. What books should I look into (aside from "Perl Testing: A Developer's Notebook")?

Edit:

  1. The web application is written in Java
  2. I want to test the application's web GUI, which makes use of javascript/ajax & some flex/flash


  1. WWW::Mechanize, WWW::Selenium and LWP::Simple just to name a few.

  2. 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.

  3. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消