Skip to main content

You're testing a payment gateway API responsible for handling financial transactions. Its primary function is to ensure that funds are transferred only when the account balance of the user is sufficient. In the test cycle, the following scenario was observed.

Two simultaneous requests from two different devices for the same transaction-drawing money, for example, ₹10,000-an API processes both requests, deducting ₹20,000 from the account while it holds only ₹15,000.

You're testing a payment gateway API responsible for handling financial transactions. Its primary function is to ensure that funds are transferred only when the account balance of the user is sufficient. In the test cycle, the following scenario was observed.

Two simultaneous requests from two different devices for the same transaction-drawing money, for example, ₹10,000-an API processes both requests, deducting ₹20,000 from the account while it holds only ₹15,000.

Any suggestions are welcome?


@Ramanan 

To address this issue and ensure that the payment gateway functions correctly, consider implementing the following testing strategies:

1. Concurrency Testing

  • Simulate Multiple Requests: Use tools like JMeter or Postman to simulate multiple simultaneous requests to test how the API handles them.
  • Check for Race Conditions: Monitor how the system behaves when multiple requests are made at once and ensure that it correctly manages account balances.

2. Boundary Testing

  • Test Edge Cases: Create test cases where the account balance is exactly at or just below the required amount (e.g., ₹10,000 and ₹15,000) to see how the API responds.
  • Verify Responses: Ensure that when a request exceeds the available balance, it returns an appropriate error message and does not process the transaction.

Reply