You need to sign in to do that
Don't have an account?
James Billings
getEmailInvocations in a test always 0
I have a method in a class which is sending an email out. It works fine, but I want to add a test for it.
I've created my test, and used the following to check if the email was queued:
Integer invocations = Limits.getEmailInvocations(); System.assertEquals(1, invocations);
However it always fails, with invocations being 0. I added debug statements to my email-sending method, and these suggest it's "working" from the test (i.e. Messaging.sendEmail returns success).
One possible cause is that the method that calls the email sending method is a @Future(callout=true) - would this cause the emailinvocations to not get seen in the test?
1. I've tried it in both places (inside the Start/End test, and outside, but no difference)
2. Not in the test class, no. The class being tested is also a VF Page controller extension which may or may not be relevant too.