Search code examples
testingnetworkingprogressive-enhancement

Strategies to block an external webservice to simulate "down" during for a testing scenario?


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


Solution

  • 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.