Faking a web service for testing

rats on 2005-02-21T22:34:55

So how to write a dummy xmlrpc server? Obviously look in CPAN. Two modules grabbed my attention: SOAP::Lite and RPC::XML.

The old webapp uses XMLRPC::Lite (a subclass of SOAP::Lite) to access the web service so why not use XMLRPC::Lite in server mode? But RPC::XML::Server has a nice feature: add_method. Allows me to package my canned server responses as methods in external files and restart the server and it will read the external file and add the method to its available services. Very nice for automated testing. Test merely(!) has to start the xmlrpc server with a known response file, run the test on the webapp, print pass or fail then restart server with a different response file and so on.

Time passes...

RPC::XML::Server is definitely the way to go! Works well and I now have a controllable/configurable web service server for my tests.