Unit Tests


Test.isRunningTest() Check

If your unit test executes code that will call SDK methods that eventually result in an HTTP Callout, the SDK call needs to be wrapped in an IF block to determine if it is running in Test context.

// Set up Signature Request
HelloSign.SignatureRequestService sigReq = new HelloSign.SignatureRequestService();

//Check to see if code is running in test context
if (!Test.isRunningTest()) {
  //if not running in test context, execute
	HelloSign.ServiceObjects.SignatureRequestResponse response = sigReq.send();