You need to sign in to do that
Don't have an account?
David Durant 5
TestMethod does not support Web service callouts Error
I have a test class and trigger that I have completed. Currently, it is giving me an error on the web services callout. I tried to do some research to understand why it was giving me this error. I know that the piclist field that I am referencing has a web service callout on the lead object but I am refereing to it on the opportunity. I also do not know where or how to even set up the mock callout to allow myself to obtain code coverage. Can anybody offer any advice on where to start?
I read both
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_restful_http_testing_httpcalloutmock.htm
And
https://help.salesforce.com/apex/HTViewSolution?id=000138850&language=en_US
I understand that I need to build a mock web service but I have no idea where to start.
Here is my code:
I read both
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_restful_http_testing_httpcalloutmock.htm
And
https://help.salesforce.com/apex/HTViewSolution?id=000138850&language=en_US
I understand that I need to build a mock web service but I have no idea where to start.
Here is my code:
@isTest public class TestUtilityUpdate{ static testMethod void myTest(){ Account acc= new Account(name='Test - Properties'); insert acc; set<String> strNames = new set<String>{'Los Angeles Department of Water and Power', 'Adams Ranch', 'Amarillo Mutual', 'Anaheim, City of', 'Arcadia, City of' }; List<Opportunity> lstOpp = new List<Opportunity>(); for(String str : strNames) { Opportunity opp = new Opportunity(Water_Agency__c=str,name=str,closedate=system.today(),stagename='Consult to be Scheduled',Accountid=acc.id); lstOpp.add(opp); } insert lstOpp; } }
Please post your account and opportunity trigger code
I think we fixed that. :)
Thanks,
Himanshu