Skip to the page

Testing a UI feature and estimating · mid

Testing a payment flow and OTP login

Payment and login flows have waiting states, failures and security rules. A test plan lists the normal path, the failures, the slow cases and the double-count risks, and uses test modes without any production backdoor.

The notes

What you must know

  • UPI cases: success; failures (wrong PIN, low balance, bank down); user cancels; the collect request expires; slow approval (minutes); network drop; closing the tab; back button; double click; refresh on the pending screen.
  • Pending is a normal state: the UI polls or listens for the server status, and the server confirms with the gateway API or webhook, never from the browser alone.
  • Layers: unit tests for amounts in paise, UPI ID format and the state reducer; integration with the API mocked (MSW) for each status; one or two real sandbox runs. Gateways have test modes (Razorpay has success@razorpay and failure@razorpay).
  • No double counting: one order id per attempt, the server ignores repeated webhooks and confirms. Test by sending the webhook twice and by racing the browser confirm against the webhook. After release watch success rate by method and bank, payments pending too long and reconciliation mismatches.
  • OTP cases: valid, wrong, expired and reused OTPs; resend with a cooldown timer; attempt limits and lockout; changing the number; pasting; leading zeros; slow SMS; the app going to the background.
  • Automation: test numbers with a fixed OTP, or reading the OTP from a test API, only in non-production environments. Never a backdoor that can reach production.
  • Auto-fill: autocomplete="one-time-code" and inputmode="numeric". WebOTP on Chrome for Android needs the SMS last line in the form @your-domain #123456. In apps: Android SMS Retriever or User Consent API, and textContentType="oneTimeCode" on iOS.
  • Security tests: rate limits per number and IP, no OTP in API responses or logs, OTP tied to the number and session, brute-force tests, and the same response for unknown numbers. Monitor SMS delivery rate and time by operator, OTP success rate and resend rate.

The red pen

Common traps: mistake → fix

  • Mistake: The browser success page means the payment succeeded

    Fix: only the server and gateway confirm.

  • Mistake: A fixed test OTP in the app is fine for speed

    Fix: only in non-production environments.

  • Mistake: Testing success and failure covers payments

    Fix: pending, expiry and duplicates cause real bugs.

Easy to hard

Questions interviewers ask, easy to hard

  1. How would you test a UPI payment flow?
  2. How do you test login with an OTP?
  3. How do you test that a payment is not counted twice?
  4. How do you automate OTP tests without weakening security?

Explain it out loud

Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.

Practise by voice

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview