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
jheuvel73jheuvel73 

Batchable class with Callouts and HttpCalloutMock throws Callout Exception

A batchable class with a callout, using HttpCalloutMock in a testclass, doesn't seem to combine. (v29)
This will throw an Callout Exception (“You have uncommitted work pending”). However no DML has taken place yet.
When using a custom mock to run the Test, it will validate.
This unmanaged packages shows the issue: https://login.salesforce.com/packaging/installPackage.apexp?p0=04tb0000000MSlV
 Comment out line 17 in TST_testBatch to see the problem occuring...
 Anyone ever encountered this? Looks like a Salesforce bug to me...



NehalNehal (Salesforce Developers) 
Hi,

This seems to be an issue in salesforce and salesforce team is working to get this issue resolved in next release tentatively scheduled to be fixed in Winter '15 Safe Harbour.

I hope this helps.