Test Plan for Membership Renewals
We need to create a test suite which we can use repeatedly to validate a comprehensive set of scenarios for processing membership renewals. We should be able to:
- load a known sample set of data
- run unit tests which trigger the renewal function for each scenario
- compare the expected and actual database state for each scenario
Renewal Processing
The general cases and processing rules are:
Renew A CURRENT Membership
"Current" membership means that the calculated membership_status has is_current_member = TRUE. For this case we are basically extending the End Date for the existing membership record and inserting a membership log record. Processing is the same for Rolling and Fixed membership periods.
- Update the existing membership record
- Join Date and Start Date are NOT modified
- New End Date = existing End Date + (Duration Unit * Interval)
- Status ID is updated based on new Start and End Dates
- Reminder Date is updated based on new End Date - Renewal Reminder Days (if membership_type.renewal_reminder_day is not NULL)
- Insert new membership_log record
- New Start Date = existing End Date + 1 day (this is the start of the renewed membership period)
- New End Date = same value as written to membership record
- Status ID = same value as written to membership record
- Modified Date = today

SCENARIO 1 - Current Membership + Rolling Period + Duration: 1 year
Record
Join Date
Start Date
End Date
Status
Modified Date
Initial Data
membership
20070101
20070101
20071231
Current
Renew on 20070410
Expected Result
membership updated
20070101
20070101
20081231
Current
membership_log inserted
20080101
20081231
Current
20070410

SCENARIO 2 Current Membership + Fixed Period + Duration: 1 year + Fixed Start Day: Jan 1 + Rollover Day: Nov 30
Record
Join Date
Start Date
End Date
Status
Modified Date
Initial Data
membership
20061201
20060101
20071231
Current
Renew on 20071210
Expected Result
membership updated
20061201
20060101
20081231
Current
membership_log inserted
20080101
20081231
Current
20071210
NOTE: Scenario 2 demonstrates that the Fixed Rollover Day is NOT SIGNIFICANT for renewal of a current membership (it doesn't matter whether we are renewing within the "rollover window" or not - we still just increment the End Date by the "duration").

SCENARIO 3 - Current Membership + Rolling Period + Duration: 1 month
Record
Join Date
Start Date
End Date
Status
Modified Date
Initial Data
membership
20070101
20070101
20070131
Current
Renew on 20070110
Expected Result
membership updated
20070101
20070101
20070228
Current
membership_log inserted
20070201
20070228
Current
20070110

SCENARIO 4 - Current Membership + Rolling Period + Duration: 3 month
Record
Join Date
Start Date
End Date
Status
Modified Date
Initial Data
membership
20070901
20070901
20071130
Current
Renew on 20071110
Expected Result
membership updated
20070901
20070901
20080229
Current
membership_log inserted
20071201
20080229
Current
20071110

SCENARIO 5 - Current Membership + Rolling Period + Duration: 30 days
Record
Join Date
Start Date
End Date
Status
Modified Date
Initial Data
membership
20070101
20070101
20070130
Current
Renew on 20070110
Expected Result
membership updated
20070101
20070101
20070301
Current
membership_log inserted
20070131
20070301
Current
20070110
Renew An EXPIRED Membership
"Expired" membership means that the calculated membership_status has is_current_member = FALSE. For this case we are modifying both the Start and End dates in the existing membership record, and inserting a membership log record. Start and End Date calculations are handled in the same way as a NEW membership (the difference being that we update the expired membership record rather than inserting a new one.
- Update the existing membership record
- Join Date is NOT modified
- New Start Date = today for Rolling period membership types
- New Start Date = fixed period start day (prior to today) for Fixed period membership types
- New End Date = New Start Date + (Duration Unit * Interval) for Rolling and Fixed membership types
- Status ID is updated based on new Start and End Dates
- Reminder Date is updated based on new End Date - Renewal Reminder Days (if membership_type.renewal_reminder_day is not NULL)
- Insert new membership_log record
- New Start Date = same value as written to membership record
- New End Date = same value as written to membership record
- Status ID = same value as written to membership record
- Modified Date = today

SCENARIO 6 - Expired Membership + Rolling Period + Duration: 1 year
Record
Join Date
Start Date
End Date
Status
Modified Date
Initial Data
membership
20050101
20050101
20051231
Expired
Renew on 20070401
Expected Result
membership updated
20050101
20070401
20080331
Current
membership_log inserted
20070401
20080331
Current
20070401

SCENARIO 7 Expired Membership + Fixed Period + Duration: 1 year + Fixed Start Day: Jan 1 + Rollover Day: Nov 30
Record
Join Date
Start Date
End Date
Status
Modified Date
Initial Data
membership
20051201
20050101
20061231
Expired
Renew on 20071210
Expected Result
membership updated
20051201
20070101
20081231
Current
membership_log inserted
20070101
20081231
Current
20071210
NOTE: Scenario 4 demonstrates that the Fixed Rollover Day is considered when calculating new End Dates on renewal of a expired membership.

SCENARIO 8 - Expired Membership + Rolling Period + Duration: 1 month
Record
Join Date
Start Date
End Date
Status
Modified Date
Initial Data
membership
20050101
20050101
20050131
Expired
Renew on 20071230
Expected Result
membership updated
20050101
20071230
20080129
Current
membership_log inserted
20071230
20080129
Current
20071230

SCENARIO 9 Expired Membership + Fixed Period + Duration: 1 month
Record
Join Date
Start Date
End Date
Status
Modified Date
Initial Data
membership
20050121
20050101
20050131
Expired
Renew on 20070125
Expected Result
membership updated
20050121
20070101
20070228
Current
membership_log inserted
20070101
20070228
Current
20070125

SCENARIO 10 - Expired Membership + Rolling Period + Duration: 30 days
Record
Join Date
Start Date
End Date
Status
Modified Date
Initial Data
membership
20050101
20050101
20050130
Expired
Renew on 20070405
Expected Result
membership updated
20050101
20070405
20070504
Current
membership_log inserted
20070405
20070504
Current
20070405

SCENARIO 11 Expired Membership + Fixed Period + Duration: 1 year + Fixed Start Day: Jan 1 + Rollover Day: Nov 30
Record
Join Date
Start Date
End Date
Status
Modified Date
Initial Data
membership
20051021
20050101
20051231
Expired
Renew on 20071130
Expected Result
membership updated
20051021
20070101
20071231
Current
membership_log inserted
20070101
20071231
Current
20071130
Renew a STALE Membership
STALE membership means that the calculated membership_status does not match the membership status.
For this case renewal will be done in two steps.
1. Check the Membership dates while renewing and update the membership status.
- Update the existing membership record
- Only status_id of the membership will be modified. Rest values will be unchanged.
- Insert new membership_log record
- Start Date = same value as written to membership record
- End Date = same value as written to membership record
- Status ID = same value as written to membership record
- Modified Date = today
2. Renew the membership.
- Update the existing membership record
- Join Date is NOT modified
- New Start Date and New End Date will be as per the Updated Status rules
- Status ID is updated based on new Start and End Dates
- Reminder Date is updated based on new End Date - Renewal Reminder Days (if membership_type.renewal_reminder_day is not NULL)
- Insert new membership_log record
- New Start Date and New End Date will be as per the Updated Status rules
- Status ID = same value as written to membership record
- Modified Date = today

SCENARIO 12 - Current (stale) Membership + Rolling Period + Duration: 1 year + End Event adjustment for GRACE status is 1 month
Record
Join Date
Start Date
End Date
Status
Modified Date
Initial Data
membership
20070101
20070101
20071231
Current
Renew on 20080112
Expected Result (1)
membership status updated
20070101
20070101
20071231
Grace
membership_log inserted
20070101
20071231
Grace
20080112
Expected Result (2)
membership updated
20070101
20070101
20081231
Current
membership_log inserted
20080101
20081231
Current
20080112

SCENARIO 13 Current (stale) Membership + Fixed Period + Duration: 1 year + Fixed Start Day: Jan 1 + Rollover Day: Nov 30
Record
Join Date
Start Date
End Date
Status
Modified Date
Initial Data
membership
20061201
20060101
20071231
Current
Renew on 20080125
Expected Result
membership status updated
20061201
20060101
20071231
Grace
membership_log inserted
20060101
20071231
Grace
20080125
Expected Result
membership updated
20061201
20060101
20081231
Current
membership_log inserted
20080101
20081231
Current
20080125
Additional Scenarios
Enter additional scenarios in this section. These scenarios should test against / combine the following variations:
- Status at renewal = Grace
- Duration units = xx days AND increment to calculate New End Date crosses to next month
- Duration units = xx months AND increment to caclulate New End Date crosses to next year

2 Comments
Hide/Show CommentsJun 01, 2007
dave hansen-lange
It seems that there is a BIG assumption here that for a renewal the organization wants to extend the membership by one membership duration. This is often not the case. For many organizations it is preferable to instead add one duration from the current date, not the end date. See my CiviMember Phase 2 Spec for more explanation.
Jan 12, 2011
Damion Dooley
I think another test case is needed for "Renew An EXPIRED Membership". A mid-year Fixed start-date (Oct 1 say), Annual renewal case please!
Ran into this as a result of a problem we had with our fixed renewal date, 1 year memberships scenario. Our renewal date is Oct 1. Our expired user hadn't renewed from previous October. They just tried on Jan 11 to renew. I'll post the bug report elsewhere, but in summary, the year that was calculated for start date was 2011, hence new account was to be Oct 1, 2011 (which prevents creation of new membership as usually no membership status is matched) . The problem isn't exposed with a January 1 start date in case above.
Thanks!