You need to sign in to do that
Don't have an account?
mansi
Test class urgent help!!
Hi can any one tell me how to cover the below code in the test class..
Class name is SaveOnEditAmexCampaignCtrlrExt
only first few lines of my below code are covered.. please tellme how to cover the whole method
}
hey i think i have done all the three points that you mentioned. please have a look at my test class and tell me how can i increase the coverage of that method.
All Answers
Hi Mansi,
The job of test is to transverse each line of your code to provide adequate coverage.
So basically in your test class you need to create date which will pass through each if /else clause of your code.
Though the exact cause analysis can be done if one goes through the code.
Yes it may happen that:-
So in case the problem persists do share the test method which you have written so a proper analysis can be done.
thanks, but it is not going beyond the if statement only... and i have no idea how to do that
As far as i think it might be because of the new code that i have added in my previous code of the same class.. i have simply called the method using an instance of the class but it stops at the if statement. please tell me how to increase the full coverage
Hi Mansi,
You have not posted complete code so I am not able to get how you are putting values in your wrapper list.However,
before calling the fetchOffersForTheSelecetdMerchants() method from the test class you need to make sure that-
1-accountWrapperList containts few values.So, add them from your test clas or if you have defined logic in your controller class then call that logic first.
2- Make sure wrapper list have few values checked(checkbox field must be true for few of them)
3-Make sure 'se' variable is not null or empty..
Above steps will cover the for loop you are having and "offerMer" list will have few values.
Few next lines depends on "offerMer" list so you must have values in it to cover code.
"lstOffers" is a collection of records you are getting from query so make sure you are getting records as next lines are dependent on this list..In this way go ahead and you would be able to cover the code...
hey i think i have done all the three points that you mentioned. please have a look at my test class and tell me how can i increase the coverage of that method.
hey, you are calling lot of methods before making a call to fetchOffersForTheSelecetdMerchants().
I guess values of wrapper list are getting changed by other calls..Would be great if you debug the wrapper list after each call in your test class..this is the way you can find out whether you are able to fulfill the conditions or not.