# api-automation-demo **Repository Path**: joyamon/api-automation-demo ## Basic Information - **Project Name**: api-automation-demo - **Description**: 基于pytest封装的api测试框架 - **Primary Language**: Unknown - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-12-22 - **Last Updated**: 2025-12-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # api-automation-demo ### 项目结构 ``` api-automation-demo ├── assert ├── config ├── __init__.py └── settings.py ├── data ├── logs ├── reports ├── tests └── utils ├── __init__.py └── logger.py └── request_client.py ├── cibftest.py └── pytest.ini ├── README.md ├── requirements.txt └── run_tests.py ``` ```bash # 1. 安装依赖 pip install -r requirements.txt # 2. 运行所有测试 pytest # 3. 运行特定标记的测试 pytest -m smoke pytest -m "smoke or auth" pytest -m "not slow" # 4. 运行指定文件 pytest tests/test_user_api.py # 5. 运行指定类 pytest tests/test_user_api.py::TestUserAPI # 6. 运行指定方法 pytest tests/test_user_api.py::TestUserAPI::test_user_login # 7. 生成HTML报告 pytest --html=report.html # 8. 并行运行测试 pytest -n auto # 9. 失败重试 pytest --reruns 3 --reruns-delay 2 # 10. 覆盖率报告 pytest --cov=utils --cov=tests --cov-report=html # 11. 详细输出 pytest -v # 12. 设置环境变量 API_ENV=test pytest ```