+ Start a Discussion
Sumit  61Sumit 61 

How to right test class for normal trigger. I have written test class for Handler class.

  1. trigger EventTriggers on Event (after insert, after update) {
  2.     EventHandler.AddCampaginMember(trigger.new);
  3. }
Varun AnnadataVarun Annadata
Then the testclass should cover this trigger also?Check once?
Sumit  61Sumit 61
Yes I have checked and found the coverage of this trigger 90% but still I am getting this error:

Code Coverage Failure
The following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.
EventTriggers
Varun AnnadataVarun Annadata
Where you are getting this error?While running the test class?
Amit Chaudhary 8Amit Chaudhary 8
Can you please post your test class here ? I hope you are deploying test class with trigger also in production ?

Writing the test class for you trigger is very simple you just need to insert one event record in your test class