You need to sign in to do that
Don't have an account?
![code developer code developer](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
Regarding Unit Test classes
Hi,
I am new apex and visualforce. I have simple question. Why we write "static" keyword for test methods.
Thanks in advance.
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Hi,
I am new apex and visualforce. I have simple question. Why we write "static" keyword for test methods.
Thanks in advance.
Hi,
Like the other methods, we are not calling the test method by the class instance.
Some standard salesforce mechanism invokes the test method of a perticular class.
You might be knowing that the static methods can be directly accessed by the class name itself. They doesn't need to create an instance of it's class to access.
So test methods are given " static " keyword in order the salesforce test execution mechanism can invoke a test method directly by just it's class name.
All Answers
Hi,
Like the other methods, we are not calling the test method by the class instance.
Some standard salesforce mechanism invokes the test method of a perticular class.
You might be knowing that the static methods can be directly accessed by the class name itself. They doesn't need to create an instance of it's class to access.
So test methods are given " static " keyword in order the salesforce test execution mechanism can invoke a test method directly by just it's class name.
Thank you very much Harsha!!!