# stillstream-ink/mall4j-ui-api-autotest architecture

> Architecture diagram of the GitHub repository stillstream-ink/mall4j-ui-api-autotest, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/stillstream-ink/mall4j-ui-api-autotest
- Repository: https://github.com/stillstream-ink/mall4j-ui-api-autotest

## Overview

Mall4j UI + API 自动化测试项目：通过 Pytest 运行 UI 与 API 两条测试轨道，对本地 Mall4j 电商系统执行登录及产品、会员、门店、订单和系统管理验证。README 还描述了契约、数据库、性能、弱网、兼容性、RBAC 与缓存专项。图中纳入主要页面对象和 API 封装；未展示的专项实现以目录级节点表示。关系仅依据 README 或 SOURCE INDEX 明示的引用，未据此推断未展示的调用链。

Main entry points: [`testcases`](https://github.com/stillstream-ink/mall4j-ui-api-autotest/tree/main/testcases) (测试套件), [`conftest.py`](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/conftest.py) (共享 Fixture), [`common/db_helper.py`](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/common/db_helper.py) (数据库断言工具), [`api/client.py`](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/api/client.py) (HTTP 客户端)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["运行与基础设施"]
  node_suites["测试套件"]
  node_settings["运行配置<br/>[settings.py]"]
  node_fixtures["共享 Fixture<br/>[conftest.py]"]
  node_logger["统一日志<br/>[logger.py]"]
  node_dbhelper["数据库断言工具<br/>[db_helper.py]"]
end

subgraph group_api["API 测试轨道"]
  node_api_client["HTTP 客户端<br/>[client.py]"]
  node_api_login["登录接口<br/>[login_api.py]"]
  node_api_crud["通用 CRUD 接口<br/>[crud_api.py]"]
  node_api_batch2["批次二接口<br/>[batch2_api.py]"]
  node_api_batch3["批次三接口<br/>[batch3_api.py]"]
  node_api_member["会员接口<br/>[member_api.py]"]
  node_api_order["订单接口<br/>[order_api.py]"]
  node_api_product["产品接口<br/>[product_api.py]"]
  node_api_shop["门店接口<br/>[shop_api.py]"]
  node_api_rbac["RBAC 接口<br/>[rbac_api.py]"]
end

subgraph group_ui["UI 测试轨道"]
  node_pages_base["页面操作基类<br/>[base_page.py]"]
  node_ui_login["登录页面对象"]
  node_ui_product["产品页面对象<br/>[product_page.py]"]
  node_ui_shop["门店页面对象<br/>[shop_page.py]"]
  node_ui_order["订单详情页面"]
  node_ui_other["其他管理页面"]
end

subgraph group_validation["专项验证"]
  node_schema["登录契约校验<br/>[login_schema.py]"]
  node_specials["专项验证"]
end

node_engineer(("测试执行者"))
node_mall_api(("Mall4j 后端"))
node_browser(("浏览器"))
node_mysql[("MySQL 数据库")]

node_engineer -->|"运行测试"| node_suites
node_suites -->|"共享配置"| node_fixtures
node_fixtures -->|"读取配置"| node_settings
node_fixtures -->|"创建客户端"| node_api_client
node_fixtures -->|"使用登录接口"| node_api_login
node_fixtures -->|"创建连接"| node_dbhelper
node_api_login -->|"调用"| node_api_client
node_api_client -->|"发送请求"| node_mall_api
node_api_crud -->|"验证接口"| node_mall_api
node_api_batch2 -->|"验证接口"| node_mall_api
node_api_batch3 -->|"验证接口"| node_mall_api
node_api_member -->|"验证接口"| node_mall_api
node_api_order -->|"验证接口"| node_mall_api
node_api_product -->|"验证接口"| node_mall_api
node_api_shop -->|"验证接口"| node_mall_api
node_api_rbac -->|"验证权限接口"| node_mall_api
node_suites -->|"执行 UI 用例"| node_ui_login
node_suites -->|"执行 UI 用例"| node_ui_product
node_suites -->|"执行 UI 用例"| node_ui_shop
node_suites -->|"执行 UI 用例"| node_ui_order
node_suites -->|"执行 UI 用例"| node_ui_other
node_ui_login -->|"操作页面"| node_browser
node_ui_product -->|"操作页面"| node_browser
node_ui_shop -->|"操作页面"| node_browser
node_ui_order -->|"操作页面"| node_browser
node_ui_other -->|"操作页面"| node_browser
node_ui_login -->|"继承操作"| node_pages_base
node_ui_product -->|"继承操作"| node_pages_base
node_ui_shop -->|"继承操作"| node_pages_base
node_ui_order -->|"继承操作"| node_pages_base
node_api_client -->|"记录请求"| node_logger
node_dbhelper -->|"读取连接配置"| node_settings
node_dbhelper -->|"记录数据库活动"| node_logger
node_suites -->|"校验契约"| node_schema
node_suites -->|"断言数据"| node_dbhelper
node_suites -->|"运行专项验证"| node_specials
node_specials -->|"测试接口行为"| node_mall_api
node_specials -->|"检查数据状态"| node_mysql

click node_suites "https://github.com/stillstream-ink/mall4j-ui-api-autotest/tree/main/testcases"
click node_settings "https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/config/settings.py"
click node_fixtures "https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/conftest.py"
click node_logger "https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/common/logger.py"
click node_dbhelper "https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/common/db_helper.py"
click node_api_client "https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/api/client.py"
click node_api_login "https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/api/login_api.py"
click node_api_crud "https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/api/crud_api.py"
click node_api_batch2 "https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/api/batch2_api.py"
click node_api_batch3 "https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/api/batch3_api.py"
click node_api_member "https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/api/member_api.py"
click node_api_order "https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/api/order_api.py"
click node_api_product "https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/api/product_api.py"
click node_api_shop "https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/api/shop_api.py"
click node_api_rbac "https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/api/rbac_api.py"
click node_pages_base "https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/pages/base_page.py"
click node_ui_login "https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/pages/login_dialog_page.py"
click node_ui_product "https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/pages/product_page.py"
click node_ui_shop "https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/pages/shop_page.py"
click node_ui_order "https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/pages/order_detail_page.py"
click node_ui_other "https://github.com/stillstream-ink/mall4j-ui-api-autotest/tree/main/pages"
click node_schema "https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/schemas/login_schema.py"
click node_specials "https://github.com/stillstream-ink/mall4j-ui-api-autotest/tree/main/testcases"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_suites,node_settings,node_fixtures,node_logger,node_dbhelper toneBlue
class node_api_client,node_api_login,node_api_crud,node_api_batch2,node_api_batch3,node_api_member,node_api_order,node_api_product,node_api_shop,node_api_rbac,node_mysql toneAmber
class node_pages_base,node_ui_login,node_ui_product,node_ui_shop,node_ui_order,node_ui_other toneMint
class node_schema,node_specials toneRose
class node_engineer,node_mall_api,node_browser toneIndigo
```

## Components

### 运行与基础设施

- [测试套件](https://github.com/stillstream-ink/mall4j-ui-api-autotest/tree/main/testcases): `testcases`
- [运行配置](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/config/settings.py): `config/settings.py`
- [共享 Fixture](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/conftest.py): `conftest.py`
- [统一日志](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/common/logger.py): `common/logger.py`
- [数据库断言工具](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/common/db_helper.py): `common/db_helper.py`

### API 测试轨道

- [HTTP 客户端](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/api/client.py): `api/client.py`
- [登录接口](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/api/login_api.py): `api/login_api.py`
- [通用 CRUD 接口](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/api/crud_api.py): `api/crud_api.py`
- [批次二接口](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/api/batch2_api.py): `api/batch2_api.py`
- [批次三接口](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/api/batch3_api.py): `api/batch3_api.py`
- [会员接口](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/api/member_api.py): `api/member_api.py`
- [订单接口](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/api/order_api.py): `api/order_api.py`
- [产品接口](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/api/product_api.py): `api/product_api.py`
- [门店接口](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/api/shop_api.py): `api/shop_api.py`
- [RBAC 接口](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/api/rbac_api.py): `api/rbac_api.py`

### UI 测试轨道

- [页面操作基类](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/pages/base_page.py): `pages/base_page.py`
- [登录页面对象](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/pages/login_dialog_page.py): `pages/login_dialog_page.py`
- [产品页面对象](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/pages/product_page.py): `pages/product_page.py`
- [门店页面对象](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/pages/shop_page.py): `pages/shop_page.py`
- [订单详情页面](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/pages/order_detail_page.py): `pages/order_detail_page.py`
- [其他管理页面](https://github.com/stillstream-ink/mall4j-ui-api-autotest/tree/main/pages): `pages`

### 专项验证

- [登录契约校验](https://github.com/stillstream-ink/mall4j-ui-api-autotest/blob/main/schemas/login_schema.py): `schemas/login_schema.py`
- [专项验证](https://github.com/stillstream-ink/mall4j-ui-api-autotest/tree/main/testcases): `testcases`

### Other components

- **测试执行者**
- **Mall4j 后端**
- **浏览器**
- **MySQL 数据库**

## Connections

- 测试执行者 → 测试套件: 运行测试
- 测试套件 → 共享 Fixture: 共享配置
- 共享 Fixture → 运行配置: 读取配置 (evidence: `conftest.py`)
- 共享 Fixture → HTTP 客户端: 创建客户端 (evidence: `conftest.py`)
- 共享 Fixture → 登录接口: 使用登录接口 (evidence: `conftest.py`)
- 共享 Fixture → 数据库断言工具: 创建连接 (evidence: `conftest.py`)
- 登录接口 → HTTP 客户端: 调用 (evidence: `api/login_api.py`)
- HTTP 客户端 → Mall4j 后端: 发送请求
- 通用 CRUD 接口 → Mall4j 后端: 验证接口
- 批次二接口 → Mall4j 后端: 验证接口
- 批次三接口 → Mall4j 后端: 验证接口
- 会员接口 → Mall4j 后端: 验证接口
- 订单接口 → Mall4j 后端: 验证接口
- 产品接口 → Mall4j 后端: 验证接口
- 门店接口 → Mall4j 后端: 验证接口
- RBAC 接口 → Mall4j 后端: 验证权限接口
- 测试套件 → 登录页面对象: 执行 UI 用例
- 测试套件 → 产品页面对象: 执行 UI 用例
- 测试套件 → 门店页面对象: 执行 UI 用例
- 测试套件 → 订单详情页面: 执行 UI 用例
- 测试套件 → 其他管理页面: 执行 UI 用例
- 登录页面对象 → 浏览器: 操作页面
- 产品页面对象 → 浏览器: 操作页面
- 门店页面对象 → 浏览器: 操作页面
- 订单详情页面 → 浏览器: 操作页面
- 其他管理页面 → 浏览器: 操作页面
- 登录页面对象 → 页面操作基类: 继承操作 (evidence: `pages/login_dialog_page.py`)
- 产品页面对象 → 页面操作基类: 继承操作 (evidence: `pages/product_page.py`)
- 门店页面对象 → 页面操作基类: 继承操作 (evidence: `pages/shop_page.py`)
- 订单详情页面 → 页面操作基类: 继承操作 (evidence: `pages/order_detail_page.py`)
- HTTP 客户端 → 统一日志: 记录请求 (evidence: `api/client.py`)
- 数据库断言工具 → 运行配置: 读取连接配置 (evidence: `common/db_helper.py`)
- 数据库断言工具 → 统一日志: 记录数据库活动 (evidence: `common/db_helper.py`)
- 测试套件 → 登录契约校验: 校验契约
- 测试套件 → 数据库断言工具: 断言数据
- 测试套件 → 专项验证: 运行专项验证
- 专项验证 → Mall4j 后端: 测试接口行为
- 专项验证 → MySQL 数据库: 检查数据状态
