I'm getting the flowing error in Webservice test class.
Methods defined as TestMethod do not support Web service callouts?
I think in test execution we need to make a callout or I'm not sure what is wrong with test class. After googled about it I came to know that we need to store a response static resource and make a callout like below.
StaticResourceCalloutMock mock = new StaticResourceCalloutMock(); mock.setStaticResource('myStaticResourceName'); mock.setStatusCode(200); mock.setHeader('Content-Type', 'application/json');
In my actual test class, I am doing like below
test.startTest(); insert agmnt; Test.setMock(WebServiceMock.class, new LeadCreation_Mock()); NewAssignmentCreation.sendcbp(gm.id, con.id, agmnt.Name,agmnt.Name, con.id); test.stopTest(); }
Do we need to call response in test class using the static resource? If Yes, Can anyone help me to how to do that?