in reply to Seeking advice for testing a web service client

Take a look at HTTP::Server::Simple.


  • Comment on Re: Seeking advice for testing a web service client

Replies are listed 'Best First'.
Re^2: Seeking advice for testing a web service client
by xdg (Monsignor) on Jan 10, 2007 at 14:18 UTC

    I'm not sure I understand how this improve on mocking/wrapping LWP::UserAgent::request(). I still need to inject the mock response to a request to HTTP::Server::Simple -- and this adds an extra layer of complexity. Is there some sample code you could point me to?

    HTTP::Server::Simple seems to be at the heart of many test failures on Win32, so I'm extra wary of using it if I don't have to. c.f. Vanilla Perl Problem Modules: Test::HTTP::Server::Simple, Test::WWW::Mechanize.


    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

      For my tests of WWW::Mechanize::Shell, I wrote me Test::HTTP::LocalServer, which allows me to test simple interaction by providing canned responses and logging the incoming requests and outgoing responses. Depending on what you want to do, this might be sufficient for your needs, as all higher-level interaction can be faked by mocking LWP::UserAgent::request I guess.