You need to sign in to do that
Don't have an account?
Losintikfos
WSDL2APEX
Hi Experts,
Quick advice! i have a WSDL2Apex class on my sandbox which i want to deploy to prod. My question is, do i need to write a test class for it before it can be successfully loaded to salesforce?
B
Quick advice! i have a WSDL2Apex class on my sandbox which i want to deploy to prod. My question is, do i need to write a test class for it before it can be successfully loaded to salesforce?
B
In the Force.com IDE right click on the "classes" folder
select Force.com
select Run Tests
to see the test coverage of your classes.
http://wiki.apexdevnet.com/index.php/Force.com_IDE
message: Average test coverage across apex classes and triggers is 0%, atleast 75% coverage is reguired.
149 lines notes tested, 0% covered.
Does it mean i need to write a test for the wsdl to apex class.
Message Edited by Losintikfos on 08-26-2008 07:00 AM
http://www.salesforce.com/us/developer/docs/apexcode/index.htm
and search for "Testing and Code Coverage"
I have a quick question! my appex classes after clicking on run test derives the message:
Code Coverage results:
0 lines not tested, 100% covered! withought any warnings or failures - yet i can't deploy it to production. Do you know why?
Message Edited by Losintikfos on 08-26-2008 07:32 AM
Right click on the "classes" folder and select Force.com -> Run Tests
Classes > Force.com > Run Test
This then generate the message:
Code Coverage Results
0 lines not tested, 100% covered.
But when i do deploy to server i dont have the code change appearing on salesforce.
Message Edited by Losintikfos on 08-26-2008 08:13 AM
In the "Apex Code Text Runner" tab, do you see an expandable section called "Code Coverage Results" ?
i see something like this:
green check mark followed by the apex class name -- message 0 lines tested, 100% covered
Quick qestion!
Do i create a seperate apex class for the testing or a method withing the apex class i want to test?
I would create a seperate test class. As a best practice start the name of the class with "test"
I have the class below;
global class APiNorthstar {
WebService static string addAccount(String AccA, String name){
comSFNorthstarApi.NorthstarServiceHttpSoap11Endpoint stub
= new comSFNorthstarApi.NorthstarServiceHttpSoap11Endpoint();
/*Invoke remote method via the service stub*/
String call = stub.Northstar(name, AccA);
/*Return response*/
return call;
}
}
I am writing a test class below to invoke it;
public class testAPiNorthstar {
public static testMethod void testAPi(){
string AccA = 'A';
String name = 'B';
APiNorthstar test = new APiNorthstar();
string pipe = test.addAccount(AccA, name);
System.debug(pipe);
}
}
My problem is, if i try to save the test class i get error:
Do you know what i am doing wrong here?
Help please.:smileysad:
Message Edited by Losintikfos on 08-27-2008 04:44 AM
string pipe = APiNorthstar.addAccount(AccA, name);
Quick question! do you know whay i am getting 15% coverage?
I decided to change it to below, to cover the soap API invocation but still returns 15% - need your expert advice dev!
public class testAPiNorthstar {
public static testMethod void testAPi(){
string AccA = 'A';
String name = 'B';
string pipe = APiNorthstar.addAccount(AccA, name);
System.debug(pipe);
}
}
Message Edited by Losintikfos on 08-27-2008 05:42 AM
Cheers:smileyvery-happy:
Use that as your guide when writing the test class.
I rely on test coverage screen to review the lines of code covered under test method.
if you click on the coverage percentage (e.g. 65%) the popup shows your code and the lines which are not covered by the test method are highlighted in red.
Would love to see a feature like this in Force.com IDE.
So did you ever create a test class for the wsdl2Apex class, or only for the APINorthstar class? I currently am looking into creating a test class for a wsdl2apex class, but having trouble doing that.