Salesforce Winter 25 Release

Write Mock SOQL Tests For External Objects

Write Mock SOQL Tests For External Objects

When we write any Apex class which involves some sort DML operation around the External object, we need to write the test classes as well. Writing test class is needed to make sure atleast 75% of the code is covered in the test class with both positive, negative and bulkified scenarios. In case of SOQL statements, we normally create the test data in the test setup method and query them in the test methods. But in case of SOQL which involves External object, we can not do that and also we can not directly query the External objects. But test coverage is needed for the Apex class to be deployed in Production.

In Winter 25 Release, Salesforce brings the solution to this problem. Now we can write mock SOQL statements for External Objects.

read more