You need to sign in to do that
Don't have an account?
test class scenerio
hi there,
friends I have a vf page that generating pdf and that page has a controller that is getting data from a master object and also from it's multiple child records using fieldsets the both objects having it's own fieldset and now when I'm doing
ApexPages.StandardController controller;
productionEditControl proController = new productionEditControl(controller);
//inserting test data... contains one production ticket and production line item under it...
production__c p = new production__c();
p.name = 'new test prodution 0011112';
insert p;
List<ProductionLineItem__c> plis = new List<ProductionLineItem__c>();
for(Integer i = 0; i<=3; i++){
productionLineItem__c pli = new productionLineItem__c();
pli.production__c = p.id;
plis.add(pli);
}
insert plis;
// now passing the id to related page to use that data inserted above...
PageReference pageRef = Page.EditProductionTicket;
pageRef.getParameters().put('id', p.id);
Test.setCurrentPage(pageRef);
// calling instance methods...
proController.save();
proController.cancel();
it's giving me an error saying .... List has no rows for assignment to SObject so please tell me how to solve it..
thanks in advance.....
Move your Controller instantiation down below your PageReference creation. The test.SetCurrentPage needs to run before you controller is created.
All Answers
Move your Controller instantiation down below your PageReference creation. The test.SetCurrentPage needs to run before you controller is created.
thanks... man .. thank u very much... it's working good.