2

I have a trigger on Account. On Account insert, I am sending a callout through future method. I am trying to write a test class for this but I am getting either of these two errors - 1) You have uncommitted work pending. Please commit or rollback before calling out and 2) Methods defined as TestMethod do not support Web service callouts, test skipped. I do not want to use Test.isRunningTest(), I want to use mock callout. Its just that I am not getting when to insert account and when to use startTest() and stopTest() and when to send mock callout. I searched for this, but do not get the code example. Help with a code example is highly appreciated. Thanks in Advance.

3
  • The general solution to this can be found here: cropredysfdc.com/2014/06/18/… (it was written for batch classes but the principle is the same for @future)
    – cropredy
    Mar 31, 2015 at 1:00
  • Thanks for your reply. But it is not what I am looking for. I tried and its not working. Mar 31, 2015 at 4:24
  • you'll need to post the barest essence of your code and testmethod to get more assistance on SFSE
    – cropredy
    Mar 31, 2015 at 20:57

0

You must log in to answer this question.

Browse other questions tagged .