+ Start a Discussion
Sunny GSunny G 

How to Call test class from trigger??? I want to deploy trigger....



I have a trigger and i want to deploy it to production... please let me know how can i achieve that. I have both the trigger and test class. This test class covers 100% code coverage if trigger in sandbox.. but fails while deployment and remains with 0% only.


Please help me with the following trigger and test class....



I certainly do not know how 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;  






Hi Sunny,



  See my post in this thread


Hope this helps.