You need to sign in to do that
Don't have an account?
ahbo
Writting Test Method
hi all, i have a class named package_controller and i would write a test method for it. can anyone tell me how to write this coz i have no idea at all....
public class Package_Controller {
private final Quotation__c quote;
private final Product2[] prod;
List<String> itemName = new String[0];
List<String> prod_id = new String[0];
public Package_Controller(ApexPages.StandardController stdController) {
this.quote = (Quotation__c)stdController.getRecord();
String sql_prod = 'SELECT id, name FROM Product2 WHERE IsActive = TRUE AND Family != NULL';
this.prod = Database.Query(sql_prod);
}
public String getPackage() {
String output = '';
Integer i, j;
String pay_list = '';
String con_list = '';
My Code Here.......
return output;
}
public PageReference toQuoteDetail() {
PageReference detailPage = new PageReference('/apex/GenQuoteDetail?id=' + quote.id);
detailPage.setRedirect(true);
return detailPage;
}
}
Hi,
static testMethod void testVF()
{
PageReference pg = Page.<Visualforce Page Name>;
Test.setCurrentPage(pg);
//Create object of class and invoke the methods on it.
}
Hope this helps
Thnaks,
OnDem
What is mean by create object of classes and method ?
I try several times before, the run test result does not show that I have cover the code.
Could you explain more or give example on the constructor / getPackage method ?
Much Thanks