Can anyone suggest me how to cover the SOQL code line in test class.
Due to Query failing i am not able to increase the code coverage to 75% minimum for class.
Suggest me how can i achieve this .
Is there any other way to increase the code coverage?
Best Answer
Mocking the external object API calls is not properly supported by SFDC yet. However, there is a pretty neat workaround by Graham Barnard. It does require some redesign of your External Object queries and it will not give you 100% test coverage (because of the
isRunnningTest()
statement). But it will allow you to functionally test the code that calls the external objectshttp://grahambarnard.com/development/2016/02/08/mocking-external-objects/