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
Marcel dos SantosMarcel dos Santos 

Suddenly Salesforce started giving me this error: Methods defined as TestMethod do not support Web service callouts

I'm getting this error when I try to run tests from a class in Salesforce:

"Methods defined as TestMethod do not support Web service callouts"

I checked forums and all the answers I found so far tell me to write http or webservice callout mocks and set them to the tests I'm running.
Even though I don't have http or webservices callouts in my Apex classes, I wrote the mocks and set them to the test code, without any success.

The error message doesn't give me any information on where is the problem being triggered, nor which class or line of code. I tried to comment the test code backwards and found out that in two different methods the error happens when:
1. I try to update an  Account;
2. I try to insert an OpportunityLineItem.

I don't have any trigger on those objects performing any callout.

Is it possible that some installed package is performing a callout and I would have to create a mock for that? Even if that is the problem, it doesn't make any sense. I tried to set a mock for http and webservice callouts and wraped the test in Test.startTest()/Test.stopTest(), without any difference.

Is it possible that this is some Salesforce bug?

 
pconpcon
Have you recently installed any packages that may have triggers on those objects?  Just writing the mock won't do you any good unless you set the mock up on the test that is failing.  Are you running all tests in your org for all namespaces, or just for your namespace?