Srotrekl/llm_qa_playground

GitHub: Srotrekl/llm_qa_playground

一个生产级 QA 自动化框架,涵盖 Web UI/API 的端到端测试以及针对 LLM 应用的安全与质量评估,提供 Allure 报告与 CI/CD 集成。

Stars: 0 | Forks: 0

# QA 自动化展示 ![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/03d267864a171840.svg) ![Python](https://img.shields.io/badge/python-3.11-blue) ![Tests](https://img.shields.io/badge/tests-39%20passed-brightgreen) ![License](https://img.shields.io/badge/license-MIT-green) 针对 **SauceDemo** 和 **Restful Booker** 的端到端 UI 和 REST API 测试套件 — pytest, Playwright, requests, Allure reporting, Postman。 ## 技术栈 | 技术 | 版本 | 用途 | |-------------|-------|------| | **pytest** | 8.3.4 | 测试运行器, fixtures, 标记 | | **Playwright** | 1.49.1 | UI E2E 测试 (POM) | | **requests** | 2.32.3 | REST API 测试 | | **Allure** | 2.13.5 | 报告(步骤、截图) | | **pydantic-settings** | 2.7.1 | 配置(env variables) | | **jsonschema** | 4.23.0 | API 响应验证 | | **ruff** | 0.8.6 | Linting + 格式化 | | **GitHub Actions** | — | CI/CD pipeline | ## 架构 ``` qa-automation-showcase/ ├── config/ # Centrální konfigurace (env variables) ├── docs/ # Test strategy, bug report template ├── pages/ # Page Object Model (SauceDemo) ├── postman/ # Postman kolekce (manuální API testy) ├── tests/ │ ├── api/ # REST API testy (Restful Booker) │ └── ui/ # UI E2E testy (SauceDemo) ├── test_data/ # Testovací data (JSON) ├── utils/ # API client, logger, Allure helpers ├── .env.example # Ukázkový .env ├── pyproject.toml # pytest + ruff konfigurace └── requirements.txt # Pinned závislosti ``` ## 快速开始 ``` # 克隆仓库 git clone https://github.com/Srotrekl/QA_automation_showcase.git cd qa-automation-showcase # 创建并激活虚拟环境 python -m venv venv source venv/bin/activate # Linux/Mac # venv\Scripts\activate # Windows # 安装依赖 pip install -r requirements.txt # 安装 Playwright 浏览器 playwright install chromium # 设置 environment variables cp .env.example .env # 如果需要更改默认值,请编辑 .env # 运行 smoke 测试 pytest -m smoke ``` ## 运行测试 ``` # smoke 测试(快速检查) pytest -m smoke # 完整回归 pytest -m regression # 仅 API 测试 pytest tests/api/ -v # 仅 UI 测试 pytest tests/ui/ -v # Negative 测试 pytest -m negative # 特定文件 pytest tests/ui/test_login.py -v ``` ## Allure 报告 ``` # 运行测试并输出 Allure pytest --alluredir=allure-results # 在浏览器中打开报告 allure serve allure-results ``` ## 测试覆盖 详细的覆盖矩阵请参见 [docs/TEST_STRATEGY.md](docs/TEST_STRATEGY.md)。 | 领域 | Smoke | Regression | Negative | |--------|:-----:|:----------:|:--------:| | 登录 (UI) | 2 | 1 | 4 | | 库存 (UI) | 2 | 6 | — | | 购物车与结账 (UI) | 2 | 2 | 3 | | 认证 (API) | 1 | — | 1 | | 预订 CRUD (API) | 2 | 5 | 3 | ## 前置条件 - **Python** 3.11+ - **Java** 8+(用于 Allure CLI) - **Node.js**(可选,用于 `npm install -g allure-commandline`) - **OS:** Windows, Linux, macOS ## Postman 集合 针对 Restful Booker 的手动 API 测试位于 `postman/` 文件夹中。 ``` # 导入到 Postman: # File → Import → 选择 postman/Restful_Booker.postman_collection.json ``` 集合包含:Auth(token)、CRUD(创建、读取、更新、删除)、Negative(不存在的预订、无 auth)。 ## 文档 - [测试策略](docs/TEST_STRATEGY.md) — 范围、测试类型、覆盖矩阵 - [Bug 报告模板](docs/BUG_REPORT_TEMPLATE.md) — 报告模板 - [关于项目](docs/PROJECT.md) — 背景、动机以及在生产环境中我会添加的内容 ## 作者 **Steve** — QA 自动化工程师
标签:AI风险缓解, LLM测试, LNA, OWASP Top 10, Playwright, pytest, QA框架, 安全规则引擎, 版权保护, 特征检测, 逆向工具