You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm a bit confused about how the NocillaUnexpectedRequest exception is supposed to work. Is the idea that it should halt the execution of the entire test suite, or rather that it should just fail an individual test?
The reason I ask is that I am migrating my project from ASIHTTPRequest to NSURLSession, and I noticed some strange problems.
ASIHTTPRequest was silently swallowing the NocillaUnexpectedRequest exceptions, so they were never seen, although I suspect I was getting an error returned from the HTTP request. It didn't matter in my tests though, as those particular tests didn't rely on the result of the unstubbed request.
However, with NSURLSession, I found that once the exception fired, no further HTTP requests could be made, and simply timed out thus causing later tests to fail. I think what may be happening is that it ended up crashing the NSOperationQueue that was being used to executing the requests by NSURLSession.
I added a nasty hack (#102) to force the exception to be raised in the main thread to make it visible, however, this obviously halted the entire test suite.
My question is, is this a bug? What is the intended behaviour of a NocillaUnexpectedRequest exception being raised?
The text was updated successfully, but these errors were encountered:
I ran into the same issue when adding Nocilla to an app which uses NSURLSession via Alamofire. At a minimum these exceptions are not visible as test failures or logs. In addition I see intermittent failures where it looks like the exception can halt other requests from being processed on that operation queue.
I remember Nocilla's exceptions cleanly failing tests the last time I used it but I can't say for sure if the difference is due to iOS 8 or NSURLSession.
PR #108 seems like a useful improvement to me. However that still does not necessarily surface unexpected requests, it depends on how the app under test responds to failed requests.
I've found that at a minimum wrapping https://github.com/luisobo/Nocilla/blob/master/Nocilla/LSNocilla.m#L79 in a dispatch_async(dispatch_get_main_queue(), ^{...} block is an improvement over the current behavior. That at least halts and fails the test suite (though potentially after the test which triggered the unexpected request). As is I'm seeing large numbers of tests fail in confusing ways when the NSURLSession's operation queue dies due to the exception.
I'm a bit confused about how the NocillaUnexpectedRequest exception is supposed to work. Is the idea that it should halt the execution of the entire test suite, or rather that it should just fail an individual test?
The reason I ask is that I am migrating my project from ASIHTTPRequest to NSURLSession, and I noticed some strange problems.
ASIHTTPRequest was silently swallowing the NocillaUnexpectedRequest exceptions, so they were never seen, although I suspect I was getting an error returned from the HTTP request. It didn't matter in my tests though, as those particular tests didn't rely on the result of the unstubbed request.
However, with NSURLSession, I found that once the exception fired, no further HTTP requests could be made, and simply timed out thus causing later tests to fail. I think what may be happening is that it ended up crashing the NSOperationQueue that was being used to executing the requests by NSURLSession.
I added a nasty hack (#102) to force the exception to be raised in the main thread to make it visible, however, this obviously halted the entire test suite.
My question is, is this a bug? What is the intended behaviour of a NocillaUnexpectedRequest exception being raised?
The text was updated successfully, but these errors were encountered: