views:

281

answers:

4

Our web application works together with several web-services which we can't influence. After each workflow (tested with Selenium) a hook call to a web-service occurs. I would like to mock that server. Ideally, I want a HTTP server object which I can start and kill at will, and an URL dispatcher which would call certain subroutines in my test when called.

So far, I have found HTTP::Server::Simple and HTTP::Server::Brick and I've found the latter more appealing. Do you have any other insider tip?

+1  A: 

I have found HTTP::Request::AsCGI to be useful for testing web application that implement the CGI interface. On the caller's side, it behaves like HTTP::Request.

You might want to try implementing the interface to the external API as a CGI.pm compatible module.

hillu
A: 

Net::HTTPServer is pretty flexible and relatively mature.

It can call subs based on URL path.

+2  A: 

For a good example look at the test suite for WWW::Mechanize, which uses HTTP::Server::Simple::CGI.

Chris Winters
+2  A: 
David