Unit-testing and sessions

So, I have started on a unit testing framework for the modules I’m
using in a web app. That’s working, but what about testing the CGI
scripts which use them? WebUnit seems to support doing this to
scripts that have already been copied into the server… Is there
a nice clean way to just run the scripts in a sandbox that looks
to the script like a server called it? I’d rather do that before
bothering the web server… Obviously, there’d also be a need for a
“live” test on the server. But for now, I’d like to be able to fake
things up and run scripts in a controlled environment. I suppose
I could just roll my own running scripts with redirected input and
output, but… Someone must have done this.

-s