I would like to test my iOS application with all the network conditions possible, including quality of the connection (offline, poor, good) and carrier (WiFi, 3G). For the former, others have already suggested using the Network Link Conditioner, e.g. here:
iPhone simulator - simulate 3G connection
which is just fine for the bandwidth and packet loss, but unfortunately it isn't able to change the carrier type that is reported to the simulator. So I'm looking for a not-so-hacky way of simulating changes in the carrier type. I said not-so-hacky because I have already come up with a hacky solution which, moreover, is incomplete as it can only deceive code which explicitly depends on Apple's famous Reachability
module. (Though if anyone is interested, I can post it here.)
Is there a way to hijack/tamper with what the SystemConfiguration
API reports?
I use the excellent OHHTTPStubs
library to test these things.
You even specify the types of connections you want to mock and their speed. And it's easy to create mock network returns in the tests. Which means you're not testing across an actual network so your tests are more determinate.