Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 220.127.116.11 release ready!
Owner and Founder. Opencart
In the previous part, we have already know how to set up the unit testing in Xcode project & some basic functionality.
In this blog, we will discuss how to test the Network Call (Asynchronous function).
In-Network call we have to wait until the data will come to its totally Asynchronous function so that we have to wait in method until the result will come for that swift provide “expectation”
With the help of this, we can handle Network call.
Here are Some Steps you need to follow this
here we have taken the example through “URLSession”
Valid URL: https://itunes.apple.com/search?media=music&entity=song&term=abba
here we are checking the URL response is valid or not.
Here we have taken the “expectation” class to hold the network call response.
We have taken two Test checking method
1: XCTAssertNil(responseError,”Any String Value”) . if responseError returns nil then there is no issue.
2: XCTAssertEqual(statusCode, 200) if statusCode == 200 then no issue
if any matches fail then you will get the test fail result.
For checking the error case you just change the URL’s string or Invalid URL & check.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Very good company, we did get app extension for Magento 2 website. The support was very good they help us through the process. Webkul team is very supportive, I would recommend them.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.