Topic: Tests involving external web services

My Rails app depends on some external web services.  These are accessed via SOAP calls using soap4r.

Related to these, there are 2 things that I would like to test:

1) The normal control-flow logic:  Does the function as a whole do as expected, assuming the web service responds appropriately?

2) The error handling for web service failure:  Does my recovery code work correctly in the case where the web service is unavailable/unresponsive?

Now, in the spirit of a good test, I want the tests to be able to run independently of the web service actually being available.  I want to be able to mock it and fake the returned results.

Does anyone have any suggestions?


If there is a post/website/blog entry/whatever that answers my questions, please don't hesitate to simply post a link.  I know it can get old fast to answer the same question hundreds of times...

Re: Tests involving external web services

For mocking the web service, try Mocha and Stubba. I don't know much about it, but there is an sd.rb podcast episode which talks about it. Worth watching.

Railscasts - Free Ruby on Rails Screencasts