Activity Forums Salesforce® Discussions When to use WebServiceMock Interface in Salesforce ?

  • Anuj

    Member
    September 23, 2020 at 1:51 pm

    When you create an Apex class from a WSDL, the methods in the auto-generated class call <samp>WebServiceCallout.invoke</samp>, which performs the callout to the external service. When testing these methods, you can instruct the Apex runtime to generate a fake response whenever <samp>WebServiceCallout.invoke</samp> is called. To do so, implement the <samp>WebServiceMock</samp>interface and specify a fake response for the Apex runtime to send. Here are the steps in more detail.
    First, implement the <samp>WebServiceMock</samp> interface and specify the fake response in the <samp>doInvoke</samp> method.

  • Marziya

    Member
    September 23, 2020 at 2:17 pm

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos