a
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
# Regression Tests
|
||||
|
||||
防止改坏现有功能的回归测试套件。
|
||||
|
||||
## 运行测试
|
||||
|
||||
```bash
|
||||
cd skills/hand-drawn-diagram
|
||||
python3 tests/run_tests.py
|
||||
```
|
||||
|
||||
## 测试覆盖
|
||||
|
||||
| Fixture | 覆盖点 |
|
||||
|---------|--------|
|
||||
| `01_sketch_basic` | sketch 风格基础架构生成 |
|
||||
| `02_flat_style` | flat 风格浅色主题 |
|
||||
| `03_semantic_shapes` | 语义节点映射 (double/cylinder/hexagon/cloud) |
|
||||
| `04_connections` | 组件连接 (Connection) |
|
||||
| `05_containers` | 分组容器 (Container) |
|
||||
| `06_html_output` | HTML 完整页面输出 |
|
||||
|
||||
## 添加新 Fixture
|
||||
|
||||
1. 在 `tests/fixtures/` 创建 JSON 文件
|
||||
2. 格式:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "my_feature",
|
||||
"description": "描述",
|
||||
"type": "quick_architecture",
|
||||
"params": {
|
||||
"title": "...",
|
||||
"layers": [...],
|
||||
"output": "__TMP__/my_feature.svg",
|
||||
"style": "sketch",
|
||||
"format": "svg"
|
||||
},
|
||||
"assertions": [
|
||||
{"check": "contains", "text": "预期文字"},
|
||||
{"check": "contains_tag", "tag": "<rect", "min_count": 2}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Assertion 类型
|
||||
|
||||
- `not_empty` — 输出非空
|
||||
- `contains` / `text` — 内容包含指定文字
|
||||
- `contains_tag` / `tag` / `min_count` — SVG/HTML 标签出现次数 ≥ min_count
|
||||
Reference in New Issue
Block a user