You need to sign in to do that
Don't have an account?
ForceUser123
Deploying Apex "Generate From WSDL" Class w/o Unit Tests
Hi,
I'm new to Apex development.
I used the "Generate From WSDL" option to create an Apex class to access our WebService.
The WebService is fairly large, the generated class came in just under the limit at 95k characters.
When I went to deploy this class from my Sandbox to our production environment (using Apache Ant),
I received an error saying 0% of my class was covered by Unit Tests.
Now, I wrote a test, but it gave a warning saying:
"Testmethods do not support webservice callouts".
So essentially Unit Tests for this class are just fillers to get past the 75% restriction.
At 95k characters, I'm looking at a lot of empty Unit Tests to get this code deployed on our production environment.
Is there currently any way to deploy an auto-generated apex class w/o writing Unit Tests?
Thanks in advance.
coverage restriction for generated package.
Do you use all methods/types defined in the WSDL.
If not, it may be a good idea to trim the WSDL before generating apex.
All Answers
coverage restriction for generated package.
Do you use all methods/types defined in the WSDL.
If not, it may be a good idea to trim the WSDL before generating apex.
Is there a way to dislike an answer even when it's the best answer?
Your answer is correct as far as I know, but it's still disappointing.
We've stooped pretty low to compensate for this.
We created a class that looks something like this.
The HUGE drawback of this approach is it inflates the total lines of Apex in your box. In some situations, organizations can't afford that kind of code bloat.
Yesterday we discovered something HUGE to help this.
Most of our partner's WSDLs create classes that are all data and no (important: no) code. These classes have THOUSANDS of lines of data. There's no-way to cover these classes in code because class definitions are never executed no matter how often you instantiate them and use their properties.
However, simply adding @isTest to the top of those classes removes those definitions from the official line count, meaning they don't have to be covered with unit tests.
We were able to remove the Compensate* classes. Our percent of Apex code used droped to 33% from 78%, and our code coverage rose from 74% to 88%.
SOLVED!