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

I'm unable to cover below Query in Test class.Can anyone help me out?
String pvd = apexpages.currentpage().getparameters().get('pv');
Pl_target_c target =[Select Name from Pl_target_c where Id=:Id.valueOf(pvd) LIMIT 1];
Pl_target_c target =[Select Name from Pl_target_c where Id=:Id.valueOf(pvd) LIMIT 1];
Create a test record for Pl_target_c object and pass the record Id as the parameter of the URL i,e pv
PageReference pageRef = Page.YourPageName;
Test.setCurrentPage(pageRef);
pageRef.getParameters().put('pv', String.valueOf(Pl_target_c Id));
Thank You,
Rajesh Adiga P.
You need to set target page like below -
PageReference pageRef = Page.<TargetPage>;
Test.setCurrentPage(pageRef);
ApexPages.currentPage().getParameters().put('pv',<Id>);
Do post here if you have any further questions.
Happy Coding!!