Reputation: 7873
I'm trying to perform a set of unit tests, which require different network connection statuses. Short of the user having to perform a bunch of steps along the way, I was wondering if there was a way to simulate conditions under a certain network connection.
I'm using AFNetworkConnectionManager
to check the connection status, but it's networkConnectionStatus
is a readonly property.
Upvotes: 2
Views: 1137
Reputation: 5181
You can use OHHTTPStubs. This is work well with AFNetworking too. This library allows to simulate different network connections and you can set custom responses, status codes for testing purposes.
https://github.com/AliSoftware/OHHTTPStubs
Upvotes: 2
Reputation: 7938
You can create a category of AFNetworkConnectionManager and make networkConnectionStatus readwrite in your test.
Upvotes: 1