1. 新增 Joyhub_ui_auto_test/ 目录: - tests/ - 测试用例目录 - pages/ - 页面元素定位 - config/ - 配置文件 - utils/ - 工具类 - test_data/ - 测试数据 - reports/ - 测试报告 - webapp-testing/ - WebApp测试相关 2. 配置文件: - pytest.ini - pytest配置 - requirements.txt - 依赖列表 - README.md - 项目说明
51 lines
783 B
Markdown
51 lines
783 B
Markdown
# Joyhub_ui_auto_test
|
||
|
||
Python UI 自动化测试项目,基于 pytest + Playwright。
|
||
|
||
## 初始化
|
||
|
||
```bash
|
||
python -m venv .venv
|
||
.venv\Scripts\activate
|
||
pip install -r requirements.txt
|
||
playwright install
|
||
copy .env.example .env
|
||
```
|
||
|
||
## 运行测试
|
||
|
||
```bash
|
||
pytest
|
||
```
|
||
|
||
## 生成测试报告
|
||
|
||
项目已配置 pytest-html,执行测试后会自动生成 HTML 测试报告:
|
||
|
||
```bash
|
||
pytest
|
||
```
|
||
|
||
报告存放路径:
|
||
|
||
```text
|
||
reports\allure-results\index.html
|
||
```
|
||
|
||
也可以只执行指定用例并生成报告:
|
||
|
||
```bash
|
||
python -m pytest tests/test_open_chrome_browser.py
|
||
```
|
||
|
||
## 目录结构
|
||
|
||
```text
|
||
config/ 配置读取
|
||
pages/ Page Object 页面对象
|
||
tests/ 测试用例
|
||
utils/ 通用工具
|
||
test_data/ 测试数据
|
||
reports/ 测试报告输出
|
||
```
|