+ Start a Discussion
Sunny GSunny G 

Pls help > How to achieve minimum 1% code coverage for the trigger?????

Hi All,


I certainly do not know how do do that. Please help me with one trigger and class.. like i have the following trigger:


trigger updaterequestowner on Pre_Sales_Request__c​ (before insert)

       Profile auth_profile = [select id from prof​ile where name='HS_StandardUser_Presales'];       ​   
       Id v_User = UserInfo.GetProfileId();
      for(Pre_Sales_Request__c ob : Trigger.new)
            if(v_User !=  auth_profile.Id)       
                   ob.Request_Owner__c =  Userinfo​.getUserId(); 


and i have the following test class :



private class TriggerTests {
    public static testmethod void testTrigger() {
       Pre_Sales_Request__c psrc=new Pre_Sales_R​equest__c( name = 'a' );
       insert psrc;
       psrc.name = 'b';
       update psrc;  




How to go to achive the code coverage while deployment, i.e. how to push test class from my trigger??  


Check out this introductory article on test methods.