I’m trying to write an automated test for my app’s response for a third party service being down.
Generally the service is always up. I’m looking for a reliable way to simulate it being down notably without requiring root access. To put another wrinkle in it: The application under test would be in a separate process. I thought of just altering the configuration pointing at the service but that’s not going to work.
This is all happening in a unix environment (linux, os x) so I’d like it to work there, but I don’t care about windows. Is there a quick way to block an outgoing port or something like that? It also has to be temporary as this has to happen in the middle of a larger test suite.
Hopefully there is a fairly standard way of doing this that I just haven’t found yet.
Clarification: This is a functional test to make sure the gui responds correctly when the service is down. The unit test is already covered.
Make a proxy for the service. Point at the proxy for the service. Shoot down the proxy for the service.