I'm setting up Unit tests for my project in Xcode 5. In a unit test, I trigger some events that will build and send an HTTP request to a server. Even though I see the request being sent and receiving a response (through Charles Web Proxy), it doesn't appear that any code from the NSURLConnectionDelegate or NSURLConnectionDataDelegate are executing, such as
– connection:didReceiveResponse:
– connection:didReceiveData:
I know there are already plenty of questions on unit testing asynchronous code but I'm concerned with why my HTTP request gets sent and receives response but my delegate doesn't execute callbacks during unit tests. I've ensured that the test isn't finishing execution before the async operation has time to complete.
Thanks.