Testing Javascript in Perl applications

There is a tool called Selenium which is used to test the Javascript component in Perl based applications. This is used to run tests directly in the browser. Actually this tool sits between Perl application, test script and browser. The test script sends the Selenium server commands to run inside the web browser. The web browser then executes those commands, and returns the results to Selenium server and then to test script. It requires JRE and a working web server to work with.

Jonathan Rockway in his book has explained and used this in Catalyst applications.

6 Replies to “Testing Javascript in Perl applications”

  1. MojoMojo has an example of a selenium test. See t/selenium.t in the MojoMojo distribution.

    In order to run the test, one must have Test::WWW::Selenium::Catalyst which has Alien::SeleniumRC as a dependency. Alien::SeleniumRC includes a selenium-server.jar that the tests are run against.

  2. It’s nice that you can test the JavaScript. At work, we find it an even bigger win because it also tests the Perl code.

  3. There’s another option out there for this kind of testing, HTMLUnit, which is a Java tool, but there’s an Inline::Java wrapper for it you can use in perl. see WWW::HtmlUnit

Leave a Reply

Your email address will not be published. Required fields are marked *