You need to sign in to do that
Don't have an account?
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
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
Callouts not allowed during test execution . Use Test.isRunningTest() as:
String response;
if(Test.isRunningTest()){
response = 'test respinse here...'
}else{
// do callout here...
}
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
Thanks for the replay
It going to the if block, Now I am getting score 0