26 October, 2018
Testing is the key to successful long term development and is a critical component of the development process. And testing is key to the success of application particularly if application to be deployed to customers.
If we validate that application works as expected, that there are no unexpected behaviors, then application will run for longtime.
There are two ways of testing an application.
Check out the top Salesforce Interview Questions now!
→ 75 % of apex code must be covered by unit tests. All of those tests must complete successfully. → When deploying to a production organization we need to have 75% of apex code covered by tests.
Note: Our focus should not be on the percentage of code that is covered instead we make sure that every use of application is covered including positive and negative cases, as well as bulk and single record. This should lead to 75% or more of code being covered by unit test.Note:
Salesforce.com recommends the following components need to test.
This includes testing to verify that a single record produces the correct, expected result2. Bulk Records:-
Any apex code, whether a triggers, a class or on extension may be used for 1 to 200 records we must test not only the single record case, but the bulk cases as well.3. Positive scenarios:-
This type of component testing expect a system to save a record without error.4. Negative scenarios:-
This type of component testing expect a system to give error.5. Restricted User:-
Test whether a user with restricted access to the objects used in code sees the expected behavior, i.e whether they can run the code or receive error messages.For indepth understanding of Salesforce click on