Is it a good idea to automate API calls used in my mobile APP in XCtests and check if response is in expected format. I want to test all the API calls used inside my app at one place rather than testing each feature which internally calls that API. This way I want to sure that my API's are working. Is there any renowned way to do it.
Do not test the Internet or the API server. Your tests should work perfectly with the network completely cut off.
You can (and should) mock the Internet for purposes of testing, and test whether your code calls the API as expected and whether, when the mock response comes back, it deals correctly with that response. The standard approach is to subclass URLProtocol (https://developer.apple.com/documentation/foundation/urlprotocol).