# yushaoqi/pytestautoapi architecture

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

- Interactive diagram: https://gitdiagram.com/yushaoqi/pytestautoapi
- Repository: https://github.com/yushaoqi/pytestautoapi

## Overview

This is a YAML-driven Python/pytest API automation framework. Users define cases, generate pytest case code, then run the suite; execution supports dependent requests, response and SQL assertions, and teardown. Results feed Allure reporting and optional notifications. The graph preserves documented recording, Swagger conversion, parallel execution, and data-driven capabilities. Some subsystem links rely on README descriptions because their implementation excerpts were not sampled.

Main entry points: [`utils/requests_tool/request_control.py`](https://github.com/yushaoqi/pytestautoapi/blob/master/utils/requests_tool/request_control.py) (Request execution), [`run.py`](https://github.com/yushaoqi/pytestautoapi/blob/master/run.py) (Suite runner), [`test_case`](https://github.com/yushaoqi/pytestautoapi/tree/master/test_case) (Generated pytest cases), [`data`](https://github.com/yushaoqi/pytestautoapi/tree/master/data) (YAML cases)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_case_authoring["Case authoring"]
  node_yaml_cases["YAML cases"]
  node_case_generation["Case generation"]
  node_swagger_conversion["Swagger conversion"]
  node_proxy_recording["Proxy recording"]
end

subgraph group_execution["Test execution"]
  node_pytest_cases["Generated pytest cases"]
  node_suite_runner["Suite runner<br/>[run.py]"]
  node_case_parsing["Case parsing"]
  node_request_execution["Request execution<br/>[request_control.py]"]
  node_dependencies["Case dependencies<br/>[dependent_case.py]"]
  node_assertions["Response and SQL assertions<br/>[assert_control.py]"]
  node_teardown["Teardown actions"]
end

subgraph group_support["Runtime support"]
  node_mysql[("MySQL access<br/>[mysql_control.py]")]
  node_cache[("Runtime cache<br/>[cache_control.py]")]
  node_config["Framework configuration<br/>[setting.py]"]
  node_logging["Logging<br/>[log_control.py]"]
end

subgraph group_results["Results and integrations"]
  node_allure_data["Allure result data"]
  node_notifications["Notifications"]
  node_allure_report["Allure report"]
end

node_user(("Test author"))

node_user -->|"authors cases"| node_yaml_cases
node_yaml_cases -->|"generates tests"| node_case_generation
node_case_generation -->|"writes cases"| node_pytest_cases
node_user -->|"converts API docs"| node_swagger_conversion
node_swagger_conversion -.->|"produces YAML"| node_yaml_cases
node_user -->|"records traffic"| node_proxy_recording
node_proxy_recording -->|"generates YAML"| node_yaml_cases
node_user -->|"runs suite"| node_suite_runner
node_suite_runner -->|"runs tests"| node_pytest_cases
node_pytest_cases -.->|"loads case data"| node_case_parsing
node_case_parsing -.->|"reads YAML"| node_yaml_cases
node_case_parsing -->|"resolves cached values"| node_cache
node_pytest_cases -.->|"invokes requests"| node_request_execution
node_request_execution -->|"loads dependencies"| node_dependencies
node_request_execution -->|"checks response"| node_assertions
node_request_execution -->|"queries assertions"| node_mysql
node_request_execution -->|"stores request data"| node_cache
node_pytest_cases -.->|"runs teardown"| node_teardown
node_teardown -->|"sends follow-up requests"| node_request_execution
node_teardown -->|"executes SQL"| node_mysql
node_teardown -->|"uses cached values"| node_cache
node_assertions -.->|"reads query results"| node_mysql
node_suite_runner -->|"produces report"| node_allure_report
node_suite_runner -->|"collects run metrics"| node_allure_data
node_suite_runner -->|"sends notifications"| node_notifications
node_allure_data -->|"reads report data"| node_allure_report
node_notifications -->|"uses result metrics"| node_allure_data
node_request_execution -->|"logs request activity"| node_logging
node_mysql -->|"logs database errors"| node_logging
node_logging -->|"resolves paths"| node_config

click node_yaml_cases "https://github.com/yushaoqi/pytestautoapi/tree/master/data"
click node_case_generation "https://github.com/yushaoqi/pytestautoapi/blob/master/utils/read_files_tools/case_automatic_control.py"
click node_swagger_conversion "https://github.com/yushaoqi/pytestautoapi/blob/master/utils/read_files_tools/swagger_for_yaml.py"
click node_proxy_recording "https://github.com/yushaoqi/pytestautoapi/blob/master/utils/recording/mitmproxy_control.py"
click node_pytest_cases "https://github.com/yushaoqi/pytestautoapi/tree/master/test_case"
click node_suite_runner "https://github.com/yushaoqi/pytestautoapi/blob/master/run.py"
click node_case_parsing "https://github.com/yushaoqi/pytestautoapi/blob/master/utils/read_files_tools/get_yaml_data_analysis.py"
click node_request_execution "https://github.com/yushaoqi/pytestautoapi/blob/master/utils/requests_tool/request_control.py"
click node_dependencies "https://github.com/yushaoqi/pytestautoapi/blob/master/utils/requests_tool/dependent_case.py"
click node_assertions "https://github.com/yushaoqi/pytestautoapi/blob/master/utils/assertion/assert_control.py"
click node_teardown "https://github.com/yushaoqi/pytestautoapi/blob/master/utils/requests_tool/teardown_control.py"
click node_mysql "https://github.com/yushaoqi/pytestautoapi/blob/master/utils/mysql_tool/mysql_control.py"
click node_cache "https://github.com/yushaoqi/pytestautoapi/blob/master/utils/cache_process/cache_control.py"
click node_config "https://github.com/yushaoqi/pytestautoapi/blob/master/common/setting.py"
click node_logging "https://github.com/yushaoqi/pytestautoapi/blob/master/utils/logging_tool/log_control.py"
click node_allure_data "https://github.com/yushaoqi/pytestautoapi/blob/master/utils/other_tools/allure_data/allure_report_data.py"
click node_notifications "https://github.com/yushaoqi/pytestautoapi/tree/master/utils/notify"
click node_allure_report "https://github.com/yushaoqi/pytestautoapi/tree/master/report/html"

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_yaml_cases,node_case_generation,node_swagger_conversion,node_proxy_recording toneBlue
class node_pytest_cases,node_suite_runner,node_case_parsing,node_request_execution,node_dependencies,node_assertions,node_teardown toneAmber
class node_mysql,node_cache,node_config,node_logging toneMint
class node_allure_data,node_notifications,node_allure_report toneRose
class node_user toneIndigo
```

## Components

### Case authoring

- [YAML cases](https://github.com/yushaoqi/pytestautoapi/tree/master/data): `data`
- [Case generation](https://github.com/yushaoqi/pytestautoapi/blob/master/utils/read_files_tools/case_automatic_control.py): `utils/read_files_tools/case_automatic_control.py`
- [Swagger conversion](https://github.com/yushaoqi/pytestautoapi/blob/master/utils/read_files_tools/swagger_for_yaml.py): `utils/read_files_tools/swagger_for_yaml.py`
- [Proxy recording](https://github.com/yushaoqi/pytestautoapi/blob/master/utils/recording/mitmproxy_control.py): `utils/recording/mitmproxy_control.py`

### Test execution

- [Generated pytest cases](https://github.com/yushaoqi/pytestautoapi/tree/master/test_case): `test_case`
- [Suite runner](https://github.com/yushaoqi/pytestautoapi/blob/master/run.py): `run.py`
- [Case parsing](https://github.com/yushaoqi/pytestautoapi/blob/master/utils/read_files_tools/get_yaml_data_analysis.py): `utils/read_files_tools/get_yaml_data_analysis.py`
- [Request execution](https://github.com/yushaoqi/pytestautoapi/blob/master/utils/requests_tool/request_control.py): `utils/requests_tool/request_control.py`
- [Case dependencies](https://github.com/yushaoqi/pytestautoapi/blob/master/utils/requests_tool/dependent_case.py): `utils/requests_tool/dependent_case.py`
- [Response and SQL assertions](https://github.com/yushaoqi/pytestautoapi/blob/master/utils/assertion/assert_control.py): `utils/assertion/assert_control.py`
- [Teardown actions](https://github.com/yushaoqi/pytestautoapi/blob/master/utils/requests_tool/teardown_control.py): `utils/requests_tool/teardown_control.py`

### Runtime support

- [MySQL access](https://github.com/yushaoqi/pytestautoapi/blob/master/utils/mysql_tool/mysql_control.py): `utils/mysql_tool/mysql_control.py`
- [Runtime cache](https://github.com/yushaoqi/pytestautoapi/blob/master/utils/cache_process/cache_control.py): `utils/cache_process/cache_control.py`
- [Framework configuration](https://github.com/yushaoqi/pytestautoapi/blob/master/common/setting.py): `common/setting.py`
- [Logging](https://github.com/yushaoqi/pytestautoapi/blob/master/utils/logging_tool/log_control.py): `utils/logging_tool/log_control.py`

### Results and integrations

- [Allure result data](https://github.com/yushaoqi/pytestautoapi/blob/master/utils/other_tools/allure_data/allure_report_data.py): `utils/other_tools/allure_data/allure_report_data.py`
- [Notifications](https://github.com/yushaoqi/pytestautoapi/tree/master/utils/notify): `utils/notify`
- [Allure report](https://github.com/yushaoqi/pytestautoapi/tree/master/report/html): `report/html`

### Other components

- **Test author**

## Connections

- Test author → YAML cases: authors cases
- YAML cases → Case generation: generates tests
- Case generation → Generated pytest cases: writes cases
- Test author → Swagger conversion: converts API docs
- Swagger conversion → YAML cases: produces YAML
- Test author → Proxy recording: records traffic
- Proxy recording → YAML cases: generates YAML
- Test author → Suite runner: runs suite
- Suite runner → Generated pytest cases: runs tests
- Generated pytest cases → Case parsing: loads case data
- Case parsing → YAML cases: reads YAML
- Case parsing → Runtime cache: resolves cached values (evidence: `utils/read_files_tools/get_yaml_data_analysis.py`)
- Generated pytest cases → Request execution: invokes requests
- Request execution → Case dependencies: loads dependencies (evidence: `utils/requests_tool/request_control.py`)
- Request execution → Response and SQL assertions: checks response (evidence: `utils/requests_tool/request_control.py`)
- Request execution → MySQL access: queries assertions (evidence: `utils/requests_tool/request_control.py`)
- Request execution → Runtime cache: stores request data (evidence: `utils/requests_tool/request_control.py`)
- Generated pytest cases → Teardown actions: runs teardown
- Teardown actions → Request execution: sends follow-up requests (evidence: `utils/requests_tool/teardown_control.py`)
- Teardown actions → MySQL access: executes SQL (evidence: `utils/requests_tool/teardown_control.py`)
- Teardown actions → Runtime cache: uses cached values (evidence: `utils/requests_tool/teardown_control.py`)
- Response and SQL assertions → MySQL access: reads query results (evidence: `utils/assertion/assert_control.py`)
- Suite runner → Allure report: produces report
- Suite runner → Allure result data: collects run metrics (evidence: `run.py`)
- Suite runner → Notifications: sends notifications (evidence: `run.py`)
- Allure result data → Allure report: reads report data (evidence: `utils/other_tools/allure_data/allure_report_data.py`)
- Notifications → Allure result data: uses result metrics (evidence: `utils/notify/wechat_send.py`)
- Request execution → Logging: logs request activity (evidence: `utils/requests_tool/request_control.py`)
- MySQL access → Logging: logs database errors (evidence: `utils/mysql_tool/mysql_control.py`)
- Logging → Framework configuration: resolves paths (evidence: `utils/logging_tool/log_control.py`)
