Posts

Showing posts from March, 2012

Unit Testing in Salesforce

Testing is a key and critical component to successful long term software development process. Salesforce.com strongly recommends using a test-driven development process which occurs at the same time as code development. Salesforce has very strong set of documentation. When I was learning salesforce unit testing, I realize that it is difficult to understand where to start read. Therefore, I summarized the unit testing for salesforce beginners to understand the basic aspects of unit testing.

There are few things to consider before you deploy or upload the code or package; 75% of your Apex code must be covered by unit testsAll the tests must complete successfullyEvery trigger has some test coverage (1%)All classes and triggers must compile successfully When you are writing a test class, you have to write test for Single Action, Bulk Action, Positive Behavior, Negative Behavior, and Restricted User. Single Action :Test to verify that a single record produces the correct, expected result.Bulk…