Test
Guide
Files
Import both files into Postman before running the suite.
| File | Description |
|---|---|
| slots-collection.json | Requests + test scripts (TC-01 … TC-14) |
Collection Variables
All variables are included in the collection. Variables marked auto are set by pre-request/post-response scripts at runtime.
| Variable | Example | Description |
|---|---|---|
| base_url | https://pyavchik.space | API base URL (use http://localhost:3001 for local dev) |
| jwt_token | eyJhbGciOiJSUzI1NiIs… | JWT Bearer token (obtain from POST /auth/login) |
| session_id | set by TC-01 | Game session identifier — auto-populated by TC-01 |
| user_id | 12345 | User ID used for IDOR checks (TC-10) |
| game_id | slot_mega_fortune_001 | Game ID passed to /game/init |
| last_spin_id | auto | Saved by TC-02 from spin response |
| balance_before_spin | auto | Saved by TC-02 for delta validation in TC-03 |
| idempotency_key | auto | Saved by TC-08 for replay tests |
Test Cases
23 test cases across three categories. TC-01 runs first and seeds session_id for all subsequent requests.
access_token to jwt_token env variableemail_takenpassword field → invalid_bodyjwt_token and sets refresh_token cookie for subsequent requestsinvalid_credentialsinvalid_bodyrefresh_token cookie set by Login; returns new access_token and rotates the cookierefresh_token cookie (Cookie header deliberately empty) → missing_refresh_tokenrefresh_token cookie; subsequent /refresh calls return 401last_spin_id and balance_before_spinbalance_after = balance_before − bet + winbonus_triggered is present, type must be free_spins or bonusitems, total, limit, offset fieldslimit=2 returns at most 2 items and echoes the correct limit and offset valuesinsufficient_balance error code−100); must be rejected at validation layeralg: none (unsigned token); must be rejectedsession_id; session lookup fails → session_expiredgame_id does not match the session's registered game → invalid_game_id0.001 below MIN_BET (0.1) → invalid_betEUR; only USD is accepted → invalid_currencylines: 0 is outside valid range (1–20) → invalid_linesidempotency_key from TC-08 with a different bet amount (2.0 vs 1.0); payload mismatch must be rejectedbet.amount: "1; DROP TABLE spins;--"; must return 4xx, not 500session_id: <script>alert(1)</script>; response body must not echo unescaped markupRetry-After header on 429Book of Dead
4 test cases covering session initialization, spin mechanics, symbol validation, and RTP configuration for the Book of Dead slot.
game_id: "slot_book_of_dead_001"; returns session_id, game_id matches request, config includes 10 paylines, RTP ~96.21%, high volatilitylines: 10; response contains a 5×3 reel_matrix and a valid win breakdownreel_matrix values must be drawn from game-specific symbols: RichWilde, Osiris, Anubis, Horus, Book, A, K, Q, J, 10config.rtp should be approximately 96.21Wallet
3 test cases covering wallet top-up, input validation, and authentication enforcement.
{"amount": 500}; expects credited: 500 and updated balance reflecting the deposit{"amount": 0} or {"amount": -1}; must be rejected at validation layerAuthorization header; endpoint must require authenticationIn Postman
Run individual requests or the full suite from the Postman desktop client.
slots-collection.json. All variables are included in the collection.jwt_token to collection variables. Session IDs are populated by init requests.Collection Runner
Execute all 14 test cases in sequence with a single click. Folder order: Happy Path → Negative → Security.
1 (full single pass). Delay — 100 ms between requests (prevents accidental rate-limit on happy path).Newman CLI
Run the entire suite headlessly from the terminal — useful for CI pipelines and automated regression.
npm install -g newman newman-reporter-htmlextra # Or use npx (no install needed)
cd postman npx newman run slots-collection.json
npx newman run slots-collection.json \ -r htmlextra --reporter-htmlextra-export report.html
# 200 ms delay (reduce load / avoid rate limit) npx newman run slots-collection.json --delay-request 200 # 10-second request timeout npx newman run slots-collection.json --timeout-request 10000 # Override base URL from CLI npx newman run slots-collection.json \ --global-var "base_url=https://api.casino-staging.com"
Notes
Edge cases and setup hints for specific test cases.
999999) or a user account with zero balance. Using a realistic balance makes the test flaky if the account has been topped up.Idempotency-Key. Either set a fixed idempotency_key value in the environment, or edit the request header to a constant string before the second run.60 and delay 0). The single collection entry only validates the response is 200 or 429 and checks for a Retry-After header when the limit is hit.