What an expiry date test does
An expiry date test verifies the expiration field on a payment form. The field holds two numbers: month and year. A valid entry uses MM/YY. The test checks three properties: format, range, and future date.
Format checks
The field must accept 4 digits plus a separator. Common separators are slash, hyphen, and space. The test rejects letters, symbols other than the separator, and extra digits. For example, 13/26 fails the month range. A single-digit month fails a two-digit month rule.
Range checks
Month values run from 01 to 12. Year values run from the current year to a limit set by the issuer. Most issuers set a 10-year limit. A test with year 00 or 99 checks the boundary.
Past-date checks
A card expires at the end of its stated month. A test on 2025-06-15 must accept 06/25 and reject 05/25. Tests at month boundaries catch off-by-one errors.
Test cases to run
- Valid future date: 12/28
- Current month: 06/25 on 2025-06-15
- Past month: 05/25 on 2025-06-15
- Month zero: 00/27
- Month 13: 13/27
- Non-numeric: AB/CD
- Missing separator: 1228
What the test does not check
An expiry date test does not verify that a card account exists. It does not check the CVV or the card number. Those checks belong to the payment processor. The test only validates the input field.