BarMeister has asked for the wisdom of the Perl Monks concerning the following question:

I would like to write a test suite to test the functionality of the ad server I am writing. I have looked at WWW::Mechanize and it seems that I can accomplish my task using this. But before I start full steam ahead with this I wanted to ask the opinions of people here on how they accomplish this?

I don't think that testing HTTP headers would be a big deal, but testing something like frequency capping and delivery order might be a little more tricky. Any ideas would be appreciated.

Thanks in advance.

Replies are listed 'Best First'.
Re: Automating Web Testing
by dragonchild (Archbishop) on Apr 09, 2006 at 12:53 UTC
    You want Test::WWW::Mechanize. This will test any webserver anywhere written in any lanugage.

    If you want to control the webserver, too, you could look at Apache::Test. That's what mod_perl is tested with.

    I was hoping I could recommend using the Rails testsuite, but that simulates requests and responses using the Rails request and response mechanisms - it doesn't actually make a web request.


    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
Re: Automating Web Testing
by hesco (Deacon) on Apr 11, 2006 at 08:17 UTC
    I like WWW::Mechanize but have found that it will not successfully navigate javascript in the tests. I have to turn the javascript off in order to test the forms hiding underneath.

    I have nothing in my own code that can not easily be derived from Test::Tutorial and WWW::Mechanize.

    -- Hugh

Re: Automating Web Testing
by BarMeister (Beadle) on Apr 12, 2006 at 04:43 UTC
    I am using a combination of WWW::Mechanize and Test::More and they are working quite well together.

    I also tried using HTML::Lint as well but it seems to parse the HTML incorrectly so I do that parsing myself....keeps saying I have unmatched <a> tags even though I have manually reviewed the tags myself and found nothing wrong with them.

    Thanks everyone for pointing me in the right direction.