function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
karthik Jonnalagaddakarthik Jonnalagadda 

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

Hello All, 

I am tring to write test class for trigger (after delete ). I am Getting "Methods defined as TestMethod do not support Web service callouts, test skipped" this error while runing test class 

Please help me out 

Thanks in advance 
Sagar PareekSagar Pareek
http://salesforce.stackexchange.com/questions/31808/method-defined-as-testmethod-do-not-support-web-service-callouts-test-skipped
Shivram SainiShivram Saini
Hi Karthik,

Callouts not allowed during test execution . Use Test.isRunningTest() as:
String response;
if(Test.isRunningTest()){
response = 'test respinse here...'
}else{
// do callout here...
}

 
Amit Chaudhary 8Amit Chaudhary 8
Hi karthik Jonnalagadda,

To resolve this issue you can try option

1) you can add Test.isRunningTest() in your main class to skip the call out the time of Call out even
https://help.salesforce.com/apex/HTViewSolution?id=000138850&language=en_US (https://help.salesforce.com/apex/HTViewSolution?id=000138850&language=en_US)
http://michaelwelburn.com/2014/03/03/a-better-way-to-use-test-isrunningtest-in-apex/
2) You can try Moke test classes.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_restful_http_testing_httpcalloutmock.htm


Please let us know if this will help you

Thanks,
Amit Chaudhary
karthik Jonnalagaddakarthik Jonnalagadda
Hello Shivram Saini,

Thanks for the replay
It going to the if block, Now I am getting score 0