Answer
A card test case is a scenario that checks how a payment system handles a card transaction. It lists the card number, expiry date, CVV, amount, and expected response. Testers run the case and compare the result to the expected response.
Parts of a card test case
- Test ID: a label, such as CT-001.
- Objective: the behavior under test, such as a card with an expiry date before today.
- Preconditions: sandbox account, test merchant ID, currency set to USD.
- Input data: card number, expiry, CVV, amount, cardholder name.
- Steps: numbered actions from opening the checkout page to submitting the payment.
- Expected result: HTTP status code, error message, and database state.
- Actual result: what the system returned.
- Status: pass or fail.
Test card numbers
Payment processors publish test card numbers for sandbox use. Stripe lists 4242 4242 4242 4242 as a Visa test card. The number passes the Luhn check. Test card numbers work in test mode. They do not work in production mode.
Test card cases include declines. Stripe provides 4000 0000 0000 0002 for a decline. 4000 0000 0000 9995 returns a code for not enough funds. Each number maps to a response code.
Test case types
- Approval case: card data, funds, success.
- Decline case: card with expiry date before today, CVV mismatch, or not enough funds.
- Format case: card number with length outside the allowed range or characters that are not digits.
- Security case: CVV mismatch, address verification system (AVS) failure.
- Edge case: zero amount, amount at the upper limit, submission sent twice.
Record keeping
Write the test case before running it. Store test cases in a version control system. Record the test card number, the processor response, and the timestamp. A test case that passes in sandbox does not prove production behavior. Run a transaction in production with a card after sandbox tests pass.