+ Start a Discussion

Test methods do not support web service callouts, but they don't have any.

I have the following test class, created by a 3rd party, that is causing issues when I attempt to edit other Apex or deploy new.  What is causing the error?
private class TestAddAgreementEventToChatterFeed
    private static testMethod void myTest()
        Contact objContact = new Contact();
        objContact.LastName = 'Test';
        List<echosign_dev1__SIGN_AgreementEvent__c > lstAE = new List<echosign_dev1__SIGN_AgreementEvent__c> ();
        insert objContact;
        echosign_dev1__SIGN_Agreement__c objA1 = new echosign_dev1__SIGN_Agreement__c();
        objA1.echosign_dev1__Recipient__c = objContact.Id;
        objA1.Name = 'Test Agreement 1';
        insert objA1;
        echosign_dev1__SIGN_Agreement__c objA2 = new echosign_dev1__SIGN_Agreement__c();
        objA2.echosign_dev1__Recipient__c = objContact.Id;
        objA2.Name = 'Test Agreement 2';
        insert objA2;
        echosign_dev1__SIGN_Agreement__c objA3 = new echosign_dev1__SIGN_Agreement__c();
        objA3.echosign_dev1__Recipient__c = objContact.Id;
        objA3.Name = 'Test Agreement 3';
        insert objA3;
        echosign_dev1__SIGN_AgreementEvent__c objAE1 = new echosign_dev1__SIGN_AgreementEvent__c();
        objAE1.echosign_dev1__SIGN_Agreement__c = objA1.Id;
        echosign_dev1__SIGN_AgreementEvent__c objAE2 = new echosign_dev1__SIGN_AgreementEvent__c();
        objAE2.echosign_dev1__SIGN_Agreement__c = objA2.Id;
        objAE2.echosign_dev1__Description__c= 'signed';
        echosign_dev1__SIGN_AgreementEvent__c objAE3 = new echosign_dev1__SIGN_AgreementEvent__c();
        objAE3.echosign_dev1__SIGN_Agreement__c = objA3.Id;
        objAE3.echosign_dev1__Description__c= 'sent out';
        insert lstAE;

Seems like you are making webservice callout in the following objects trigger code Contact or echosign_dev1__SIGN_Agreement__c.
Once the test data is created in the system, it will call workflow rule, apextrigger and other process in the system as part of the excution flow. By default, test methods don’t support web service callouts, and tests that perform web service callouts fail. To prevent tests from failing and to increase code coverage, Apex provides the built-in WebServiceMock interface and theTest.setMock method. Use WebServiceMock and Test.setMock to receive fake responses in a test method.

Check this link for more details - https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_wsdl2apex_testing.htm
Hassan AnwarHassan Anwar
Hi there,
Any solution for the above problem as it occurs due to Agreement Event object (Adobe Sign managed package) webservice callout?