Offline Error Handling Automation

Hi everyone,

I am developing the test automation for an iOS App, an Android App and a Web App where I need to test Offline error behaviour automatically.

Does anybody have an idea what I can use as a proxy between the apps and the (Azure) BE to simulate switching specific services (e.g. SignalR) on/off during an automated test run?

I haven’t found any C# client for Charlesproxy unfortunately, which I would have used to simulate this behaviour manually.

I can use the proxy in my Browserstack setting and I also found a Toxiproxy C# client which I could potentially use, but I don’t know how I can turn off the services programmatically from there.

If anybody has an idea on what I could use and/or has had a similar setting I would be greatful for some help.

4 Likes

Hi @ivan.horvatic
I’m assuming you are talking about using cloud devices, not devices you have locally. Myself only just getting into how to set proxies now, so not able to help, but keen to learn. Even with local devices, simply toggling wifi off is problematic as an approach if your test toolstack is relying on ethernet connections. Which also rules out the option of doing it in a faraday cage I guess. (BTW cages are quite expensive and elaborate.)

1 Like

Tinyproxy or squid are the common proxy choices. They could be run locally or in the cloud but you would need you own automation to stop/start them.

Another option is forward proxies. Something like haproxy or nginx, or an azure load balancer. Put Infront of the API server. You can then programmatically drop all traffic or selectively drop traffic same if a certain cookie is set. You might also want to consider firewall drops, DNS failures which can behave differently.

But actually do you need a valid proxy if the goal is to look offline. Just use an invalid IP.

However thinking about it, this isn’t really a problem you should have. For automated testing between layers you should really have mocks. So wiremock or Mountebank which would easily let you test this and other countries error conditions such as 500 responses. They can also be used as a proxy so you don’t have to full replace your app.

2 Likes

Thanks for the replies.
I decided to try creating a proxy in Azure Functions which will route my endpoints somewhere else. Then I should be able to call the Azure Function in my code.

2 Likes