in reply to How to simulate a web server behaviour

I've had a few less-than-successful experiences with Test::MockObject. The tests were hard to write and they didn't uncover real bugs because they just weren't that realistic.

I'd encourage you to build a test harness that runs a real web server talking to your real FCGI script. Then you can hit that real server (probably running on a high port) with Test::WWW::Mechanize. You can look at Apache::Test for inspiration or keep it simple. I've done this for web apps and for SMTP clients (using Net::SMTP::Server here). It's a pain to get the start/stop behavior right but once you do it's all downhill and your tests tend to find real bugs. And that's the whole point, isn't it?

-sam

  • Comment on Re: How to simulate a web server behaviour