You need to sign in to do that
Don't have an account?

Need help to write test class on Static method
Hi,
I have a static method as given below im tryong to writte a test class for this it shows error
please any one give some idea to solve this problem
public class controller { public static SPQ__c product { get; set; } public String productname { get; set; } @RemoteAction global static SPQ__c getSPQPr(String productname) { product = [select id ,Standard_Cost__c, name from SPQ__c where name= :productname and Year__c='Mid Year 2011' limit 1]; return product; } @RemoteAction global static Test__c getType() { AccType = [select Accessory_Type__c , name from Test__c where id= :'a2mQ0000001MpvE' limit 1]; return AccType; } }
Thanks,
Hi,
Below code should help you :
Once you handle the exceptions, the above code should be good to cover your class! Hope this helps.
All Answers
Hi,
Below code should help you :
Once you handle the exceptions, the above code should be good to cover your class! Hope this helps.
Vishwanath -
Wats the error you are getting?
could you plz post ur error so that it will give a view abt what exactly the prob is
but try this once
@isTest
private class TestView{
static testMethod void testtView() {
controller obj = new controller();
spq__c s = obj.product;
string str = obj.productname();
controller.getSPQPr();
controller.getType();
}
}
Thank You Vishal,
its working