+ Start a Discussion

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)