writing test classes
Here are some best practices that I felt need to be followed while writing test classes in Salesforce , Do add your thoughts too 1. All test methods should reside in a separate class from the class in which the method being tested resides. 2. These classes should be appended with the word Test followed by the name of the class being tested, e.g. OpportunityServicesTest. 3. These classes should all use the @isTest annotation. 4. Each method in the production class should have, at a minimum, one corresponding test method in its test class and should be appended by “test” 5. There should be a minimum of “Null Pointer Exception test” as part of negative testing for each method, specially the methods that accept parameters. 6. A method without an assert statement is not considered a test method. Large number of relevant assert statements increases confidence in the correct behaviour of business logic. 7. There should be a comment with each assert statement explaini...