Skip to main content


Showing posts from March, 2014

Testing Http call out using StaticResourceCalloutMock

I was working with the Http call out stuff lately and have a chance to learn on how to execute test class on this type of class.Test class...not my favorite subject in salesforce but it is very important :). I did some googling stuff and also bump into implementation of HttpCallout mock interface-- it was like phew! But I also bumped into other option which is StaticResourceCalloutMock and MultiStaticResourceCalloutMock which seem pretty easier. Okay let's get started! What is StaticResourceCalloutMock? Built-in class used to test our callouts by specifying the response body in Static Resource. Why? Easy instead of implement code using HttpCalloutMock interface.We just create dump response file in Static Resource then instantiate the StaticResourceCalloutMock. Scenario: I have class that call webservice from other server in order to get the token.It call the webservice using Http call out.So in order to let it deployed beautifully in production , I need to get higher