The objective of this test plan is to validate the correctness, reliability, and robustness of the Wallet Transaction API, with a primary focus on:
POST /wallet/{walletId}/transaction
This includes ensuring accurate financial calculations, proper error handling, and consistent system behavior under various scenarios.
- Data-Driven Testing (DDT): All transaction scenarios are driven by external JSON fixtures (
test/fixtures/transactions.json). - Mocking: A local mock server is used to simulate API responses and service latencies.
- Dynamic Identification:
userIdandwalletIdare discovered at runtime via authentication and user info endpoints.
Tests are designed to run against:
- A mock server generated from the OpenAPI spec
OR - A real API endpoint (configurable via environment variable)
| ID | Test Case | Description | Expected Result |
|---|---|---|---|
| TC-01 | Wallet Metadata | Retrieve GET /wallet/{id} |
200 OK, returns correct walletId and currencyClips array. |
| TC-02 | History Pagination (P1) | Retrieve history for page 1 | 200 OK, returns transaction list and totalCount. |
| TC-03 | History Pagination (P2) | Retrieve history for page 2 | 200 OK, validates pagination logic. |
| TC-04 | Specific Tx (EUR) | Create EUR Tx and retrieve by ID | 200 OK, retrieved data matches the created transaction. |
| TC-05 | Specific Tx (USD) | Create USD Tx and retrieve by ID | 200 OK, validates multi-currency retrieval. |
| ID | Test Case | Dataset | Expected Result |
|---|---|---|---|
| TC-06 | Happy Path Credit | EUR 100.50 Credit | 200 OK, status 'finished' and outcome 'approved'. |
| TC-07 | Happy Path Debit | EUR 50.25 Debit | 200 OK, balance deduction verified. |
| TC-08 | Happy Path Credit | USD 500.00 Credit | 200 OK, status 'finished' or 'pending'. |
| TC-09 | Happy Path Debit | USD 25.00 Debit | 200 OK, successful cross-currency support. |
| TC-10 | Happy Path Credit | AED 1000.00 Credit | 200 OK, validates exotic currency support. |
| TC-11 | Unauthorized Access | Missing Token (USD) | 401 Unauthorized returned. |
| TC-12 | Insufficient Funds | GBP 10000.00 Debit | 200 OK, status 'finished' and outcome 'denied'. |
| TC-13 | Idempotency Validation | Duplicate Request | 200 OK, returns same transactionId for duplicate keys. |
Limited to 5 prioritized items as per requirements.
| ID | Test Case | Priority | Reason for Deferred Implementation |
|---|---|---|---|
| UT-01 | 30-Min Auto Rejection | High | Requires long-duration wait or time-mocking to verify pending tx rejection. |
| UT-02 | Race Condition Testing | High | Requires high-concurrency tools (K6/JMeter) to verify wallet locks during simultaneous hits. |
| UT-03 | Service Unavailable (503) | High | Requires circuit-breaker mocking to verify system resilience when backend fails. |
| UT-04 | Precision and Rounding | High | Requires complex decimal math validation (e.g., 0.1 + 0.2) to prevent rounding leaks. |
| UT-05 | Balance Integrity | High | Requires stateful validation of ledger sum vs. balance across 100+ sequential operations. |
- Client: Supertest (HTTP assertions)
- Validation:
- Status Code matching.
- JSON Body structure (Presence of
transactionId,status). - Business logic matching (Outcome
approved/denied).