I have quite the conundrum and I'm not sure how to work around it.
I have a batch method which it's entire purpose is to do a webservice callout and write to the database about what happened afterwards.
The problem I'm running into is that during a test you cannot have uncommitted database writes pending (you cannot commit during a test as far as I'm aware) and perform a webservice callout (even if it is just using mock interface).
How do you work around this issue?
NOTE: To perform the test I also have to create a bunch of fake accounts, products and other misc peices. So even if I tried to workaround it by moving the database writes somewhere else / webservice somewhere else. It would still run into this issue.
NOTE2: It gives the following error when trying:
You have uncommitted work pending. Please commit or rollback before calling out
Test.StartTest() and Test.StopTest()? As you can't do DML before calling out and the limits are being reset for the code between these 2 methods, it should work. – Boris Bachovski Jun 14 '13 at 04:33