function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jadentjadent 

Unit Testing for Class that uses the Trigger var

I have created a utility class which has some very helpful methods when dealing with certain situations during trigger execution. This class uses the Trigger variable. This class i want to use in many instances (and potentially even release into the code share) so i need to get some proper code coverage. In order to do so i need a trigger to assist in the UnitTest. 

 

Question: Is there a best practice for creating a trigger whose only purpose is to provide support for unit testing? Is there an equivalent of the @isTest annotation for classes for Triggers? Or is there a way in a trigger to determine if the trigger is being called under a unit test (besides setting a variable in the class to indicate this, which i am currently doing)

 

Thanks