• Vivek Patel
  • 0 Points
  • Member since 2014

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 2
I have a web service call out the is working fine.  The web service callout is triggered in an After Trigger which collects some changed field data for Contacts and then sends it to my @future method that performs the call out. 

In my testmethod for this, I start by setting up some test data as usual.  The test data includes some Custom Settings data that is used by the @future method, a test account record, and a bunch of test contacts.  After I insert all of the test data, I set up my mock callout responses, do a Test.setMock(), and then call my web service callout class.  

I get no errors when I run the test, but I am not getting the required code coverage because within one of the @future's try statements, the "You have uncommitted work pending..." exception is thrown and processed by the try's catch statement, thus by-passing most of the lines of code in the class that is doing the callout.

I am trying to write one test class for the Trigger code and the callout code,  and I know that inserts performed in test methods are not committed, so am I going to have to break the testing up into multiple test methods because of this?  

I have a VisualForce page that is using the Ajax Toolkit to make a remote call. The remote call works fine but when I try to us it to do a query agains Saleseforce, it fails. The first time I attempted it the error indicated that it was trying to send the query to the remote URL, so I re-initialize the connection before I do the local query but it does not work.

Any sugestions?