Integration tests
Integration tests (TS-2) ensure that operations in the Agent Layer produce the correct records and side effects in the Backend (users, orders, transactions). They require access to Backend API and/or DB for verification.Prerequisites
- Agent Layer base URL (e.g.
https://api.nexalayer.net/v1). - Backend API URL and a way to authenticate as the backend “agent” user (e.g. openAgent) or as the created test user.
- Optional: Backend DB or read-only API to verify users, dynamic_orders, static_orders, transactions, usdt_recharge_orders.
Test cases (conceptual)
TC-I01 Register → Backend user
- Register a new agent via
POST /v1/account/register. - From Agent DB or API, get the agent’s
backend_username(andbackend_user_idif available). - Using Backend API (e.g. as openAgent), verify that a user with that username exists, with correct
agent_id/agent_name, status, and balance >= 0.
TC-I02 Dynamic session → Backend order
- Create a dynamic session (TS-1 flow) and poll until active.
- From Agent Layer, get the session’s
backend_order_no(or equivalent from session detail). - In Backend, query dynamic orders for that order (or for the backend user). Assert order exists, user_id and agent_id match, status is valid.
- Optionally verify Backend user balance decreased and transactions table has a consumption record; openAgent balance change if applicable.
TC-I03 Static session → Backend order
- Create a static session and poll until active.
- Get
backend_order_no(or equivalent) from the session. - In Backend, query static orders. Assert order exists, user_id and agent_id correct, transactions/consumption updated.
TC-I04 Recharge order → Backend
- Create a recharge order via
POST /v1/billing/recharge(do not pay). - In Backend, find the recharge order (e.g. usdt_recharge_orders) by order_id or user. Assert status pending, amount matches, user_id correct.
Assertions
- Backend users table: one row per registered agent, correct agent_id/agent_name.
- Backend dynamic_orders / static_orders: order exists and is linked to the right user and agent.
- Backend transactions: consumption entries after session create/renew.
- Backend usdt_recharge_orders: recharge order created with correct user and amount.
Data isolation
- Use a unique agent per run (e.g. name with timestamp). Clean up test sessions (terminate) and optionally test agents to avoid polluting production data.