How would you test a money transfer between cards?
A card transfer is tested as a sequence of states with a possible failure at each step and invariants that must always hold. Money is neither created nor lost, one user action gives one operation, and balance, history and audit log agree. Each case is written with data and the expected balances of both accounts; a timeout after the debit and a repeated request matter most.
QA Fundamentals · Situational questions
The "Transfer" button was clicked twice within a second. How much money will go and what will you check?
A transfer between cards looks like a form with three fields, but behind it stand money, external systems and repeated requests. The value of an answer is that you see not "fields and a button" but a sequence of states with a chance of failure at each step. This lesson shows how to split a transfer into steps, which rules (invariants) must always hold and how to write checks so the expected balances are visible.
How it works and why. A transfer is a sequence: checking the input, checking the rules (enough funds, limits, fee), debit or reservation at the sender, credit at the recipient, confirmation and a record in the history and the log. Failures can happen between steps: a timeout, a refusal by the recipient's bank, a dropped connection. So besides "does it work" it helps to hold invariants in advance. Money is neither created nor lost: the amount debited equals the amount credited plus the fee. One user action produces no more than one operation however many times the request arrives. The balance, history, notification and audit log describe the same thing. A failure in the middle does not leave "debited but not credited" with no state that can be resolved.
The steps of a transfer and what to check at each
Example: from a list of fields to cases with balances. The weak answer: "I will check valid and invalid numbers, the amount, that the money arrived". In the strong one every case has data and the expected state of both accounts:
Start: A = 5000.00, B = 1000.00, fee 0, limit 10000.00
per operation (per requirement, illustrative here).
T1 A→B 100.00 A 4900.00, B 1100.00, 1 record in both
T2 A→B 5000.01 refusal "insufficient funds", no change
T3 A→B 0.00 and -1.00 refused at validation
T4 A→B 100.005 refused (requirement: to the cent)
T5 A→A refused
T6 A→B 10000.01 refused by the limit
T7 double click, 100 one operation, A 4900.00
T8 timeout after status "processing", then credit
the debit or refund, not two operations
Now each case can be run and compared with the expectation, and not only "look whether it arrived". T7 and T8 are what separate a strong answer: both are about repeated requests and partial completion, not about fields. For T7 protection is usually done with an idempotency key on the request side, and QA checks that a repeated request with the same key does not create a second operation.
Limits and alternatives. Looking only at the interface is not enough: money moves in the backend, and for T8 you need the API and the database (read-only) or logs. Real payment flows are often asynchronous and become consistent with a delay, so an expectation like "the balance changed instantly" depends on the architecture and must be clarified. External systems (3-D Secure, the recipient's bank) are replaced in a test environment by a sandbox or a stub, and failure behaviour is simulated separately. Real card data is not used in tests: test numbers of the payment system are taken. There are separate lessons on payment states, risks and reconciliation.
Common mistakes
- Checking only the "Success" message: it does not prove the money was debited once and credited to the recipient.
- Not looking at the recipient's account: a "debited, not credited" defect stays unnoticed.
- Testing only the success path: failures, timeouts and repeated requests are the main part of risk in money operations.
- Checking the amount only with whole numbers: cents, rounding and boundaries hide typical errors.
- Using a real card or customer data for a check: that breaks security rules.
Check yourself
The user clicked "Transfer", the request returned a timeout, and the sender’s balance has already decreased. What do you check and which behaviour is correct?
Answer
I check the operation status in the backend and the recipient’s account. The right behaviour is that the system does not leave "debited without credit" with no state: the operation is in progress with a later credit, or the money is refunded, and a repeated send with the same key does not create a second operation. The interface must not say "error, try again" if the operation is actually continuing.
Why is case T4 (amount 100.005) written with the expectation "refusal" and not "rounding"?
Answer
Because in the example the requirement says: the amount is to the cent, extra decimals are rejected. The expectation comes from the requirement, not from what the system does. If the requirement said to round by a given rule, the expected result would be the rounded one, and the rule itself would be checked.