11 May 2008

Mock Web Services

I have recently completed a large financial system that comprises of many Web Services.

If a particular component needs to communicate with a Web Service it does so via a proxy class. So is the target Web Service was named something like StockPrices. The proxy would implement an interface such as IStockPrices. Using dependency inversion, the IStockPrices would be one of the parameters on the constructor of the calling client.

This allowed us to use mock and fake IStockPrices during testing. Thus we could test various failure conditions in the target Web Service

Please contribute to this article describing various integration testing techniques that you have used.