新增完善测试模板
This commit is contained in:
32
tests/desktop/README.md
Normal file
32
tests/desktop/README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# 可选桌面 E2E(pytest)
|
||||
|
||||
本目录用于**匠厂桌面 + jiangchang_desktop_sdk** 的端到端冒烟,**不是** `python tests/run_tests.py` 默认路径的一部分。
|
||||
|
||||
## 依赖
|
||||
|
||||
- `pytest`
|
||||
- `jiangchang_desktop_sdk`(由 `conftest.py` 按多级路径尝试加入 `sys.path`,见该文件说明)
|
||||
- 匠厂桌面已安装或开发态可启动,且 `jiangchang://` 协议可用
|
||||
|
||||
## 为什么不默认跑
|
||||
|
||||
- 需要真实宿主环境,无法在纯 CI/无头环境稳定复现。
|
||||
- `unittest` 的 `tests/run_tests.py` **只发现** `tests/` 根目录下 `test_*.py`,**不递归**本目录。
|
||||
- 示例文件为 **`test_desktop_smoke.py.sample`**,避免被误收集。
|
||||
|
||||
## 如何启用
|
||||
|
||||
1. 将 `test_desktop_smoke.py.sample` **复制或重命名**为 `test_desktop_smoke.py`。
|
||||
2. 按你的技能名称、路由关键词、期望输出修改 `ask` 与断言。
|
||||
3. 运行:
|
||||
|
||||
```powershell
|
||||
pytest tests/desktop/test_desktop_smoke.py -v -s
|
||||
```
|
||||
|
||||
失败时,`conftest.py` 中的 `failure_snapshot_dir` fixture 会将现场目录指向 `tests/desktop/artifacts/`(需自行避免将大文件提交进仓库)。
|
||||
|
||||
## 与后端测试的关系
|
||||
|
||||
- **后端 / CLI / DB**:请使用仓库根目录下 `python tests/run_tests.py`(见 `tests/README.md`)。
|
||||
- **桌面 E2E**:仅在本目录用 **pytest** 维护,二者互补、互不替代。
|
||||
Reference in New Issue
Block a user