+ Start a Discussion
DeptonDepton 

do I need a test method for my trigger

I have a trigger that works like I want.

If I want to deply it it production, do I have to write a test method for it? I have not written a class for it so how should I proceed?

 

Thank you

Best Answer chosen by Admin (Salesforce Developers) 
sales4cesales4ce

Yes, you need to write unit test class to deploy your trigger to production.

As a best practise, make sure you test your trigger for Bulk Inserts/Updates.

 

/**
 * Test methods for Trigger
 */
@IsTest
private class TestyourTrigger {
  
  static testmethod void testMethod() {
    //write your test logic
  }
  
  }

 

 

Hope this helps.

 

Sales4ce