Saw this on another post, have not tested it. if (!System.Test.isRunningTest()) { WebServiceCallout.invoke(...) } else { // Simulate callout here... }