You are here:
Integration Procedure Unit Testing from Apex
You can set up a test class in Apex and use it to call and test an Integration Procedure. In the core runtime, HTTP mocking isn’t possible, and real HTTP calls occur during test execution.
The following is an example unit test of an Integration Procedure:
@isTest(seeAllData=true)
global with sharing class TestVlocityIntergationProcedure
{
static testMethod void testVip()
{
Map<String, Object> inputMap = new Map<String, Object>();
inputMap.put('AccountName', 'Vlocity');
ConnectAPI.IntegrationProcedureServiceRunInputRepresentation apexInput = new ConnectAPI.IntegrationProcedureServiceRunInputRepresentation();
ConnectAPI.IntegrationProcedureServiceRunOutputRepresentation output = ConnectAPI.OmniDesignerConnect.integrationProcedureExecute('Type_Subtype', apexInput);
List<String> stringList = new List<String>();
String serializedInputMap = JSON.serialize(inputMap);
stringList.add(serializedInputMap);
apexInput.input = stringList;
ConnectAPI.IntegrationProcedureServiceRunOutputRepresentation output = ConnectAPI.OmniDesignerConnect.integrationProcedureExecute('Type_Subtype', apexInput);
List<String> responseList = output.response;
String currentSerResponse = responseList[0];
Map<String, Object> currentResponseObj = (Map<String, Object>)JSON.deserializeUntyped(currentSerResponse);
Object response = currentResponseObj.get('result');
System.assertEquals('joe@vlocity.com', response.get('ContactEmail'));
}
}
Note these features of the example:
-
You must use Salesforce's seeAllData property on the
@isTestannotation. This ensures that the unit test sees the Vlocity SObject data in the org. -
Use the
ConnectAPI.OmniDesignerConnect.integrationProcedureExecute()Connect API to run the Integration Procedure. -
The namespace is
vlocity_cmt,vlocity_ins, orvlocity_ps. -
The Type_Subtype parameter specifies the Integration Procedure to test.

