Reputation: 13
I have a set of automated UI tests for our iOS app, written with XCTest. It was required for some test cases to be verified in bad network connection conditions.
I am aware that it is possible to simulate bad network connection by using Network Link Conditioner. I know that you can enable it in settings of a real device and a simulator as well. There seem to be only manual steps involved in enabling and setting the desired state.
But, I was wondering if it was possible to automate this process - how would you go about running a suite of automated tests on the CI (if some of them are to be tested in bad network conditions)?
We are not using real devices for automated testing. I do not have the access to the machines running test suites for CI. I do not have a dedicated machine that could always have NLC enabled and set, nor can I manipulate network itself (router etc). We do not use mocks in our tests.
Upvotes: 0
Views: 1423
Reputation: 1000
Unfortunately, bad network connection/no network connection is not easily testable with XCTest and there is no easy way to set something like this up.
There are (generally) two ways to solve this:
1/ implement some kind of network connection issues to your network-communication methods and run them when running UI tests
2/ test on real device with slow internet connection set in settings.
Unfortunately - slow network connection cannot be set on Simulator nor on Mac server (which you are probably using for your CI) by default and 3rd party tools are not very good in this either.
Upvotes: 1