You need to sign in to do that
Don't have an account?
test class with many email doesn't work: Too many Email Invocations
I have a test class of a trigger with many if (exactly 12).
When I do "run test class" SF give me this error:
Too many Email Invocations: 11
if I write this line, I solve the problem but I cannot test other "if" inside:
if (limits.getemailinvocations()> limits.getLimitEmailInvocations()){
if fieldX = y send email
if fieldz = w send email
if fieldk = e send email
...
}
How Can I test the last 3 if condition ??
Is there a way to reset limits.getemailinvocations and continue the test?
I try to do this but doesn't work
limits.getemailinvocations() = null
The solution is create 2 trigger with 2 test class but it is for a beginner boy :)
Thanks
Matt,
you could write a test method for every 'if'-case.
You don't have to cover all possibilities in one method.
Hth,
Hannes
If writing more test methods is not an option (for whatever reason), you could try using Test.startTest() and Test.stopTest(), inside of this block you should get a new context of execution (meaning limits should get reset).
Hope this helps.