Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

CGI Test Framework?

by hbo (Monk)
on Jul 26, 2004 at 23:51 UTC ( #377618=perlquestion: print w/ replies, xml ) Need Help??
hbo has asked for the wisdom of the Perl Monks concerning the following question:

Hello, my fellow devotees of the arcane art of Perlogy.

I have a moderately complex Perl/CGI application that I'm helping to maintain in production. I'm interested in automating complete code coverage testing of this app. I started out writing one test case, using LWP::UserAgent and HTML::Parser. That was sort of fun to do, and the results were OK, but I also got the sinking feeling that complete code coverage was going to take a whole lot of tedious and repetitive programming, or else a lot of very intense work trying to generalize the test cases so they could even be derived from the code itself. possibly.

A third possibility is that there may be something out there in Perl Monk land that does Exactly What I Want. But I'd settle for a nice framework, tuned toward testing CGI apps, that I could use to escape some of the drudgery of generating code coverage of my moderately complicated app.

The Test:: modules are too low level for what I want. CGI::Test is too. What I want at the high level is something to organize the data flow through a CGI-style application. Lower down, It would be cool to find something that analyzed the return values of a GET or POST to determine what the outputs were, and what the next inputs might be. This is exactly the process I followed to automate my single test case, dumping the hidden and input fields from successive posts to figure out what to do next.

Is there anything out there that fits that description?

"Even if you are on the right track, you'll get run over if you just sit there." - Will Rogers

Comment on CGI Test Framework?
Re: CGI Test Framework?
by Joost (Canon) on Jul 27, 2004 at 00:23 UTC
      Writing Test ist always a lot of work, but you can speed things up with HTTP::Recorder. H:R produces W:M Scripts by default.

      On CPAN there is also HTTP-WebTest, but i never tried it.

      ciao, knoebi.

Re: CGI Test Framework?
by stvn (Monsignor) on Jul 27, 2004 at 00:41 UTC
Re: CGI Test Framework?
by hbo (Monk) on Jul 27, 2004 at 00:41 UTC
    That is pretty darned close to what I asked for! Thanks!

    WWW::Mechanize is the exact mid-level glue I need to develop complete code coverage. What it lacks as a test platform is a consistent way to represent the inputs in external files, and a consistent way to evaluate the return values of a form POST. I'm leaning toward developing these features to work with the module.

    Hmm, WWW::Mechanize::FormFiller looks like it handles the input side rather well.

    I know I'm not going to escape all the drudgery in developing my tests. But I have an extreme case of Laziness, and I'd like to duck as much of the drudge as I can. Also I'd like to build on others' work in case I come up with something useful enough to share. That way I don't have to maintain the whole pile myself. (More Laziness. At least I'm consistent. 8)

    "Even if you are on the right track, you'll get run over if you just sit there." - Will Rogers
      I know I'm not going to escape all the drudgery in developing my tests. But I have an extreme case of Laziness, and I'd like to duck as much of the drudge as I can. Also I'd like to build on others' work in case I come up with something useful enough to share. That way I don't have to maintain the whole pile myself. (More Laziness. At least I'm consistent. 8)

      I believe that Test::WWW::Mechanize is still a work in progress. You could always msg petdance (the author of both WWW::Mechanize and Test::WWW::Mechanize) and see if he is interested in any of your ideas on how to make it more useful.

      -stvn
        Yes, it looks as though he's just made a start at a test framework using his base module. I'll keep that in mind as I proceed. Thanks for the pointer!

        "Even if you are on the right track, you'll get run over if you just sit there." - Will Rogers

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://377618]
Approved by dws
Front-paged by adrianh
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2014-09-17 22:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (100 votes), past polls