Although I don't know where you'd find existing code you can download, here's
a strategy to consider if you end up needing to write this yourself:
* Make a proxy.cgi that can GET and POST forms, e.g. via LWP. It would GET
the blank form, alter the <FORM> tag to point back to itself, and show the
blank form to your user. (Save the original method, URL, and any other <FORM>
options in hidden fields.) When the user is done filling out the form, it
would submit back to the proxy.cgi, which can write the original URL etc.
(your hidden fields) and name/value pairs to a file before passing them along
to the backend CGI or whatever for processing. Take care not to create any
security issues if you do this, of course.
* Now you have a collection of what I call "test cases". Even if the forms
usually POST, many CGI programs are well written such that they will accept
the same name-value pairs via method GET. If you are so fortunate, you can
simply make a list of URLs and cycle through them with a robot, spider, or
even a script that just reads lines and does a GET on each URL. If the backend
programs only accept method POST you have a little more work ahead of you, but
it can be done.
* The fun begins if you want to save the results of one test run and compare
it with the next. Besides the obvious things that change, like the date,
you'll discover pages with "rotating banners" or other dynamic content. What's
more, some sites actually get updated from time to time. Imagine that! :) The
trick is deciding (hopefully automatically) what changes are OK and may be
ignored, and which changes mean something broke. And then there are the web
servers that are supposed to issue cookies for visitor tracking etc. yet
somehow manage to forget the cookie every third time or so. If you are saving
the headers as part of the result set, these will show up as differences also.
Of course it is up to your application whether you consider a missing cookie a
defect or merely a "feature".
* Should you be really lucky, and have control of the entire web site, you
can design your pages for easy testing. Just make sure your CGIs accept GETs
as well as POSTs, and don't mandate things like JavaScript that are harder for
robots to emulate. Also, in the web page output by the CGI program, you could
hide a success code, or the results of some calculation or lookup, in an HTML
comment. Then your "did it change since last time" logic would only have to
look for that particular comment and compare it with before, ignoring the rest
of the clutter on the page.
From: darrenb%extendsys.com@Internet on 99-12-29 11:06 PM
To: libwww%perl.org@Internet
cc: (bcc: Marvin Simkin)
Subject: LWP recorder available?
Are there any recording tools available (a netscape or explorer plugin
maybe?) that can capture get and post data from a browser and build an LWP
script from it?
Right now I have some manual tests that I need to do on a web server that
involve getting and posting data. I could code it all by hand with LWP but
it seems like their should be a tool available (I can't be the first person
who ever wanted to do this :-) that would let me just run through the tests
manually once and then have a script that could be used to re-run the test
unattended for the next go round.
Thanks!!
Darren