I'm looking for a way to test schedule reminders for memberships. We have memberships that expire in a year, and we have setup a renewal reminder which also reminds our back office staff a month before the expiry date. But I need a way to test that the reminder actually works. Is there a way to test this quickly test this...obviously I cannot wait until one month before a particular membership expires to confirm this.
It might help to differentiate types of testing, e.g.
- (User-oriented) Click-to-test/in-app test - This is the type of test supported in the CiviMail UI (which sends an example mailing). As dlobo points out, this type of test was not originally part of the scheduled reminder system, but it would be a great addition.
- (Developer-oriented) Unit testing - For developers who work on the code, there's a series of automated tests in ActionScheduleTest which simulate a dozen configurations/schedules.
- (Sysadmin-oriented) Adhoc testing - At the low-end, one might simply create a fake membership record and set the expiration date to today. At the high-end, one might replicate a site in an isolated environment (eg a local virtual machine), redirect email to disk (CIVICRM_MAIL_LOG), and manipulate the clock in the virtual machine. (This may require a deep understanding of the system as well as a lot of time/patience/discipline.)
Only way I know to test it to create an equivalent flow such as
- Set up a new Membership Type - give a contact a membership of that type
- Set up a Scheduled Reminder for above Membership Type
- Set the Membership End Dates so that the Reminder would be scheduled for today
- Run the Scheduled Reminders scheduled job
- To clear and rerun find the entry created by above in the civicrm_action_log, remove that row, rerun cron.
Not pretty but it can help. Hopefully if i missed out any steps you are able to make the mental jumps required ;-)
Unfortunately I don't think testing was built into the scheduled reminder functionality. Seems like that aspect was just skipped.
I do think like contribution and event page registrations, having the ability to:
a. test the functionality and email deliverability of scheduled reminders, sending the emails to staff / tester rather than actual person
b. Figure out how to best approach / deal with the time centric nature of scheduled reminders (i.e. how can we test 1 month out reminders? maybe compress time and/or do a scale conversion of time for testing, (i.e. hours become seconds, days becomes minutes, months become hours)
Definitely a medium sized development project and most of the ideas can be tested out via an extension, but this does seem like core functionality sometime in the future.