views:

120

answers:

3

I am working to integrate data from an external web service in the client side of my appliction. Someone asked me to test the condition when the service is unavailable or down. Anyone have any tips on how to block this site temporarily while we run the test to see how the service degrades?

For those curious we are testing against Virtual Earth, but Google Maps but this would apply to any equally complicated external service.

any thoughts and suggestions are welcome

+1  A: 

How about blocking the domain name(s) in question by putting a nonsense entry into the hosts file?

Pekka
+4  A: 

Create some Mock-Webservice class or interface (and inject it). In there, you could test the response of your system to webservice failures and also what happens, if a web-service request take longer than expected or actually time-out.

DeveloperWorks article on mock testing: http://www.ibm.com/developerworks/library/j-mocktest.html

The MYYN
+3  A: 

You need to be sure to test the most common failure modes for this:

  1. DNS lookup fails
  2. IP connection fails (once DNS lookup succeeds)
  3. HTTP response other than 200
  4. HTTP response incomplete or timeout
  5. HTTP response 200 but RPC or document returned is invalid

Those are just a few common failure modes I could think of that will all manifest themselves with different behaviors that you may wish to have your application handle explicitly.

If you set up a computer between the caller and service that routes between them, you can simulate each of these failure modes distinctly and modify your application to handle them.

shadit
I am guessing I should be looking for some sort of proxy that I can control yes?
MikeJ
An HTTP proxy works great for scenarios 3-5.
shadit
To do what I needed, I ended up using Fiddler and the content-Blocker addon that was posted to the site. I was able to answer the questions of how Bing/VE Maps behaved after the site loaded and access to the system became unavailable. Of course, most cached images were fetched and still dipslayed by unfetch content was dead (duh). Surprisingly the page didnt error or fail like I had expected so much JS based code to do.
MikeJ
Hey, that's a great result! Thanks for posting exactly what you did and how it went.
shadit