Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Testing for websites?

by Cody Fendant (Hermit)
on Sep 17, 2012 at 03:30 UTC ( [id://993949]=perlquestion: print w/replies, xml ) Need Help??

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

I appreciate the Perl culture of testing. But how do you do tests when your code runs a website?

I can't test every page of a website after I make a change to the underlying code, and anyway the code is complex, there are ads being served, some of the page is random, for variety, and the HTML guy might be working on the template at the same time.

Do people make special tests which return simpler values than whole pages? Or does website testing always require human QA testers clicking through pages in a browser?

Replies are listed 'Best First'.
Re: Testing for websites?
by chromatic (Archbishop) on Sep 17, 2012 at 03:47 UTC
    But how do you do tests when your code runs a website?

    I know what output I expect, and I test for that.

    (See Simplified HTML Testing with Mojo::DOM and Mech for an example.)

    I can't test every page of a website after I make a change to the underlying code....

    If you have code to generate every page, you can test every page.

Re: Testing for websites?
by rjt (Curate) on Sep 17, 2012 at 03:40 UTC

    You might want to have a look at WWW::Mechanize. It can definitely handle the heavy lifting of the testing automation.

    You will probably also benefit from unit testing the lower layers of your application. Do all of your library functions have unit tests that (reasonably) cover all kinds of inputs, good or bad? Test::More is your friend, here. You can also play with Test::Simple if you're new to the Perl testing style.

    You will still of course need some human QA (write a test plan for your testers that covers your requirements), but the automation can certainly help you catch coding errors more quickly.

Re: Testing for websites?
by McDarren (Abbot) on Sep 17, 2012 at 03:37 UTC
    Hi,

    I've not used it myself, but I suspect that WWW::Selenium might be what you are after.

    HTH,
    Darren

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://993949]
Approved by McDarren
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2025-06-22 03:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.