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

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

trigger Miles on Quote (before insert,before update) {
opportunity opp=[select id,Distance_in_Miles__c from opportunity where id=:q.opportunityid limit 1];


for the above trigger i wrote a test class like this....but this test class is not covering a trigger...

its showing an error like    "Methods defined as TestMethod do not support Web service callouts, test skipped ".....

please solve this problem....


public class testquote
        public static testMethod void QuotetTest()
        account a=new account(name='icc',type='new client',industry='church',phone='9985354198');
        insert a;
        opportunity opp=new opportunity(name='test',Lost_to__c='big top',Distance_in_Miles__c=200.20,StageName='Closed Won',,leadsource='website',type='rental-new client',address1__c='blr',address2__c='hyd',Application__c='aviation',Budgeted_Cost__c=2500.20,City1__c='las vegas',Divsion__c='builtsure',Country1__c='usa');
        insert opp;
        quote q=new quote(name='test',Due_With_Signed_Agreement__c=30.20,Opportunityid,Length_in_Meters__c=20,Title_of_Quote__c='this is shipping',TFS_Type_by_Width__c='20',Due_Prior_to_Shipping__c=20.20,delivery_miles__c=150.20,Amount_of_Truck__c=2000,Amount_Per_Mile__c=20.50,Due_After_Install__c=20,;
        insert q;
        update opp;
        update q;





// please solve this......


A SOQL query can not be run by using a test class. use if(test.isrunningtest()) condition to skip the SOQL query and assign the values from test class manually to cover the code.

Hope it works...

Please try this and let me know if it works..



Praveen K.


Please, use this in your test method and all will be resolved....


StaticResourceCalloutMock mock = new StaticResourceCalloutMock();
mock.setStatusCode(200); // Or other appropriate HTTP status code
mock.setHeader('Content-Type', 'application/json'); // Or other appropriate MIME type like application/xml
Test.setMock(HttpCalloutMock.class, mock);

 Here is the link to the implementation this uses:


Here is the section that covers this in general:


May The SForce Be With You!


Nathan Pepper