How can you use OCMock with NSURLConnection/delegate for a series of mock network connections?
Asked Answered
A

0

1

I've implemented the code in this posting:how to unit test a NSURLConnection Delegate?

and have managed to get a test case going with my code where I simulate sending a server package of data via the mock classes.

This is ok to test a simple single client post / server response type situation but I want to test a conversation scenario where my code makes a post, the server sends a reply, my code makes another response, the server sends another reply etc.

Has anybody done anything similar to this?

Appellate answered 9/5, 2013 at 23:32 Comment(1)
You might find my answer here https://mcmap.net/q/1021134/-testing-class-method-using-ocmock-release-2-1-1 helpful. If you are really focused on 'unit' tests, you should have separate tests that make sure you are sending the right thing to the server and make sure you handle all server responses (that can be done by just calling the delegate method from your test)Ordinance

© 2022 - 2024 — McMap. All rights reserved.