You need to sign in to do that
Don't have an account?
Mattrey
Determine trigger status in test method
Is there a way to determine the status of a trigger (active/inactive) in a test method?
I have tests that have assert() calls in them that assume the trigger is active. If I need to deactivate the trigger, I then need to go and change the test so that it still passes. It would be nice to be able to do something like:
if (trigger.status='Active'){
System.assert(trigger was fired);
}
you can use below SOQL query on apextrigger object :
ApexTrigger aa = [Select id,a.Status From ApexTrigger a where Status ='Active'];
Did this answer your question? if so, please mark it solved.
All Answers
you can use below SOQL query on apextrigger object :
ApexTrigger aa = [Select id,a.Status From ApexTrigger a where Status ='Active'];
Did this answer your question? if so, please mark it solved.
Nice - so I should be able to dosomething like
ApexTrigger trigger = [SELECT Status from ApexTrigger WHERE Name='myTestTrigger'];
if (trigger.Status='Active){
//do assert
}
Thanks Pradeep!