+ Start a Discussion
karthik Jonnalagaddakarthik Jonnalagadda 

Methods defined as TestMethod do not support Web service callouts

Hello all,

Methods defined as TestMethod do not support Web service callouts, test skipped

can anybody tell what that mean.
 
@isTest
public class TestSetIsCopiedToProjectFlagFalse {
 static testmethod void UnitTest()
    {
      
         Account objAcc = new Account(Name = 'karthik test');
          insert objAcc;
     
    Ibanking_Project__c  objIbanking_Project = new Ibanking_Project__c();
       objIbanking_Project.Name='karthiktest trigger';
        objIbanking_Project.Company__c=objAcc.Id;
          Insert objIbanking_Project;

          Delete objIbanking_Project;
    
    }
}

 
Andy BoettcherAndy Boettcher
TestMethods do not make callouts.  You'll want to implement either WebServiceMock or HttpMock depending on what your callout is/does.
sfdc Beginnersfdc Beginner
Hi Karthick,

In order to Test Web Service Callouts we have to create an Apex Class that Implements WebServiceMock Interfaces and in order
to Test HTTP Callouts an Apex Class has to implement HttpCalloutMock Interface.

Please find the links for writing test classes implementing WebServiceMock  & HttpCalloutMock Interface.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_wsdl2apex_testing.htm

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_restful_http_testing_httpcalloutmock.htm


Thanks,
SFDC Beginner
karthik Jonnalagaddakarthik Jonnalagadda
Hello sfdc Beginner,
I am writing test class for trigger.may I  why should I Impliment WebServiceMock  & HttpCalloutMock Interface?