Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Testing for websites?

by Cody Fendant (Friar)
on Sep 17, 2012 at 03:30 UTC ( #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 (Deacon) 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

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


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://993949]
Approved by McDarren
[marioroy]: Today, wanted to revisit running parallel Re: Crash with ForkManager on Windows. I tried running on Cygwin for comparison.
[marioroy]: Running parallel on Cygwin feels like running on Unix ;-)
[marioroy]: Fortunately, Strawberry Perl v5.26 runs well.
[karlgoethebier]: marioroy: He! Magic Mushrooms was a talk in the CB some days ago ;-)

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2017-09-23 16:02 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (272 votes). Check out past polls.