You need to sign in to do that
Don't have an account?
decentshail
Test method coverage: param not covered.
Hi All,
I have to covered my apex class but there is issue due to param value setting
<apex:commandLink style="color:blue" action="{!ResubmitRequest}">Resubmit
<apex:param name="role" value="{!t1.Name}"/>
</apex:commandLink>
in apex code we getting the values as -
public string change = ApexPages.currentPage().getParameters().get('role');
and now query on a object based on change condition.
i have my test method-
PageReference pageRef = Page.myVFPage;
ApexPages.currentPage().getParameters().put('role', testObj.Name);
Test.setCurrentPage(pageRef);
ApexPages.StandardController thecontroller = new ApexPages.StandardController(testFO);
CoverageHistory controller = new CoverageHistory(thecontroller);
controller.ResubmitRequest();
Issue is change values always getting null value.
Did you check whether you are getting the value for testObj.Name in the Test Class? Test it by placing the debug statement in test Class.
Regards,
Shravan
any param from visualforce page in test method is not set like
Instead we create a scenario similar to end user by assigning a value to param assigned to value in your case value attribute , like this
let me ask if any issue in it.