I am using iPhone Sen testing framework for testing. I need to test the asynchronous responses coming from server. Can anyone help me to find out the way to test it.
Thank you
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This may have been a duplicate question, but I don’t agree with the answer to the original one. I’ve described why in length on that question.
In summary, creating a custom run loop for your tests is complicated and fragile. Your tests will run more consistently and more quickly if you remove the dependency on the external service that is returning the asynchronous responses and mimic the responses in your tests. This way your tests won’t fail if the external service goes down, and your tests will run much more quickly.
There are libraries available that reopen classes like NSURLConnection and make this easy to do. It’s also relatively simple to do for a single class (like NSURLConnection), thanks to the dynamic properties of Objective C. Here is an example.