Perl Web Test

last modified: September 15, 2003

The Perl module HTTP::WebTest helps you to test your WebApplication. You can tell it to fetch a WebPage from an URL, and then test if the result contains the text you expect.

You define your test in a configuration file that looks like this:

text_forbid = ( Software error)
test_name = FrontPage
       url = "http://c2.com/cgi/wiki"
       text_require = ( Front Page )
end_test

then you run the test with the program wt:

wt testingwiki.wt

you get a detailed report:

Total web tests failed: 0  succeeded: 3
Failed  Succeeded  Test Name
   0          3    FrontPage

Test Name: FrontPage
URL: http://c2.com/cgi/wiki

  STATUS CODE CHECK
    Expected '200' and got: 200 OK                               SUCCEED
  FORBIDDEN TEXT
    Software error                                               SUCCEED
  REQUIRED TEXT
    Front Page                                                   SUCCEED

CategoryTesting WebTesting


Loading...