On Jul 1, 2005, at 10:10 AM, Mark Stosberg wrote:
On 2005-06-29, Shawn Sorichetti <[EMAIL PROTECTED]> wrote:
HTTP::Server::Simple is a module by Jesse Vincent. It uses only
modules that are included with Perl to provide a basic webserver,
that works really well for testing.
Two questions:
1. Does this technique make it faster to run the test suite than
using a
real Apache?
HTTP::Server::Simple doesn't have any requirements other than modules
which ship with Perl. Not having to have Apache installed for
automated tests has made it easier for me to test on multiple
platforms. Not having to setup an Apache configuration test
configuration would have to be another benefit, although I imagine
there are times when using Apache to test may provide additional
benefits.
I've used this technique to run 4 servers on my Thinkpad, and probed
them with 4 WWW::Mechanize probes each. It's worked quite well. As a
side note Test::WWW::Mechanize is now using HTTP::Server::Simple for
it's tests, and I'll be converting WWW::Mechanize shortly.
2. What about customizing the port number? [ checks. ] I can answer
this
one myself: $server->port($my_personal_port_no).
# If something goes wrong, make sure to stop the HTTP server.
sub cleanup { kill(9,$pid) }
$SIG{__DIE__}=\&cleanup;
Would it be better to put this in an END block? I'm not sure if this
signal gets thrown at a normal exit. I use END blocks in test scripts
for stuff like this and they work well.
I think END blocks works whether the death is premature or not.
I'll test this out and update the code before I add it to the Wiki.
-Shawn
---
Shawn Sorichetti
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]