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
mba75mba75 

Deploy Viualforce page with callout

When I run the test to deploy a visualforce page I get the following error :
 
System.TypeException: Testmethods do not support webservice callouts.
 
It's hard to believe than you can write some apex code and you can not deploy .
 
Anybody know how to get around that limitation?
 
 
  
kyleRochekyleRoche
get rid of the section of the test method that calls the webservice. you have to obtain code coverage elsewhere. If you can't get enough covered you can dummy up some lines to reach 75%

integer i = 0;
i++
i++
etc.
Ron HessRon Hess
What i find myself doing is breaking the code up so that the callout is the end or near end of a method. Then i do the processing in a separate method, which i can pass parameters into from a test perspective, this allows met to get coverage on the post callout code, as my test method can pass in a valid XML string such as i would expect from the callout.

it gets the coverage that i need without adding no-op statements.