+ Start a Discussion
BradCBradC 

The majority of my test methods are failing due to "Methods defined as TestMethod do not support Web service callouts "

Hey everyone, I'm at my wit's end. 40 of my unit test methods are failing with this error: "Methods defined as TestMethod do not support Web service callouts. Stack trace: null" seemingly out of nowhere. I haven't installed any new packages nor deployed any code that uses web service callouts in quite some time. I'm not sure why this is happening all of a sudden or what the source is. The test methods that are failing don't have any interaction with the few callout classes we do have (nor are there reference to them in those test methods).

Any help would be greatly appreciated!
v varaprasadv varaprasad
Hi BradC,

If we use HTTP callouts in class.Then we need to use  HttpCalloutMock Interface To test HTTP Callouts.

More Info on this please check once below links : 

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_restful_http_testing_httpcalloutmock.htm
http://salesforceprasad.blogspot.sg/2017/05/test-class-for-xml-dom-parser-and.html
https://developer.salesforce.com/blogs/developer-relations/2013/03/testing-apex-callouts-using-httpcalloutmock.html


I hope it helps you.

Please let me know in case of any other help.

Thanks
Varaprasad