Posts

Showing posts from May, 2017

Be a champ in test class. Test classes from start to end.

Image
For  development of robust, error-free code, Apex Code requires the creation and execution of unit tests. Unit tests are class methods that verify whether a particular piece of code is working properly.  Unit tests are written in Apex Code and annotated with the  annotation @testmethod.  The test methods must provide at least 75% code coverage.  Code coverage is calculated by dividing the number of unique Apex code lines executed during your test method execution by the total number of Apex code lines in all of your trigger and classes. Defining a Test Method using the  testMethod  keyword For defining  an Apex method as a 'test method',Define the method as  static  and add the keyword  testmethod.  Classes defined with the  isTest  annotation do not count against your organization limit of 2 MB for all Apex code. Classes annotated with  isTest  can be declared as private or public.  @isTest public class totestClass { static testMethod void myTest(