Summary
In this chapter, you've learned every basic step of unit testing in Salesforce. These basics are necessary for any deployment process.
Salesforce recommends 75% overall coverage, but I recommend covering as much as possible. You can't test everything, such as throwing an exception during a network interruption, but most of the time, you are able to have test coverage for at least 85% for classes with more than 50 lines.
Remember, there are three important steps that you must take into account while you are creating your tests: create your own test data, perform your test scenario and execute it between the Test.startTest() and Test.stopTest() functions, and verify your retrieved result with assertions.
Happy testing!
It's time to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access