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

test class for update the case object record?
hi all,
I wrote a test class but i am unable to cover the test coverage for that ineed below sample code
I am retriving case object fields in controller based on ID in URL.
And updating the same object with new fields.
can any one give the sample test class for this.
Thanks in Advance.
I wrote a test class but i am unable to cover the test coverage for that ineed below sample code
I am retriving case object fields in controller based on ID in URL.
And updating the same object with new fields.
can any one give the sample test class for this.
Thanks in Advance.
To get code coverage for your class you need to create a test(s) that will execute the lines of code in your controller class. Based on what your code does, you should think about several different tests you should have that will test you code works correctly (and other things like handling errors conditions or bulkfication) i.e. if you input X in you get Y out.
Check out the 'Test Methods and Visualforce Controllers' section in this guide : https://developer.salesforce.com/page/An_Introduction_to_Apex_Code_Test_Methods
Hope that helps,
Richard Jimenez
Seems you forgot to put your code.
As per my understanding you are trying to get some fo values from URL parameters and placing them into some of fields in your class. for that you need to first set the url parameter before you call the actual class method.
this code can help you or give some idea
for instance if your url parameter is "ID"
then set that id as below
ApexPages.currentPage().getParameters().put('ID',emp.id);
Make sure on giving parameter name as it is case sensitive.
let me know, if it helps you or need any help :)
shiva.sfdc.backup@gmail.com
Please paste the actual class and test class then it will be easy to help you.
Regards,
Mahesh
Please look into the below code:
As I am not able to see your code, this is the sample code which you have to change according to your class and variables.
Still if you are facing any problem then , post your Class here so that it will be easy to provide you the answer.
Please do let me know if it helps you.
Regards,
Mahesh