mit einem Klick
testing-checklist
开发新功能时的测试清单,确保不遗漏任何测试层级
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Menü
开发新功能时的测试清单,确保不遗漏任何测试层级
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Basierend auf der SOC-Berufsklassifikation
执行 Office4AI MCP Server 验收测试 —— Phase 1 注册验收(tools/resources/收敛) + Phase 2 功能验收(manual_test E2E)
Edit an existing Word / PowerPoint / Excel file — especially template operations (fill {{placeholders}} and SDT content controls, reuse slide masters, change spreadsheet data while preserving charts) — by submitting a short Python script to the office4ai `office_run_script` tool. Works with no Office Add-In connection. Use when the user asks to fill a template, update a report/deck/workbook, replace placeholders, or edit a .docx / .pptx / .xlsx while keeping its styling intact.
Extract a reusable template from a reference Word / PowerPoint / Excel file — turn concrete values into placeholders — by submitting a short Python script to the office4ai `office_run_script` tool. Word headings become named SDT content controls, concrete text becomes {{tokens}} for docxtpl, a designed slide becomes a reusable master layout, an Excel named range becomes a blanked template region. Works with no Office Add-In connection. Use when the user has a finished/reference document but no template, and wants to reuse its structure/branding to generate more files.
Create Word / PowerPoint / Excel files from scratch or from a reusable template by submitting a short Python script to the office4ai `office_run_script` tool. Works with no Office Add-In connection. Use when the user asks to generate a .docx / .pptx / .xlsx, produce a report / deck / workbook, or instantiate a corporate template.
Demo authoring SKILL fixture — exercises the skill:// resources source mode (root + scripts + references + binary asset). Triggers in S3 producer tests only.
以架构师视角审查代码变更,关注模块边界、DTO 规范、测试完整性和长期可维护性。 当需要审查 PR、工作区变更或提交代码时使用。
| name | testing-checklist |
| description | 开发新功能时的测试清单,确保不遗漏任何测试层级 |
| usage | 开发新功能时参考此清单,确保完成所有必要测试。 如需详细代码示例,请参阅 TESTING_STANDARD.md |
Unit Tests (tests/unit_tests/) → DTO验证、Service逻辑 [CI ✅]
Integration Tests (tests/integration_tests/) → Socket.IO服务器+客户端 [CI ✅]
Contract Tests (tests/contract_tests/) → Mock Add-In完整流程 [CI ✅]
Manual Tests (manual_tests/) → 真实Office E2E验证 [CI ❌]
class MockAddInClient:
async def connect(self) -> None: ...
async def disconnect(self) -> None: ...
def register_response(self, event: str, factory: Callable[[dict], dict]) -> None: ...
def register_static_response(self, event: str, response: dict) -> None: ...
@property
def received_events(self) -> list[tuple[str, dict]]: ...
# 静态响应
mock_client.register_static_response("word:get:selectedContent", {"success": True, "data": {...}})
# 动态响应
mock_client.register_response("word:get:selectedContent", lambda req: {"requestId": req["requestId"], ...})
@pytest.mark.asyncio
@pytest.mark.contract
async def test_event_success(workspace, mock_addin_client, word_factory):
# Arrange: 注册Mock响应
mock_addin_client.register_response("event_name", lambda req: {...})
# Act: 执行动作
result = await workspace.execute(action)
# Assert: 验证结果
assert result.success is True
tests/contract_tests/
├── conftest.py # Fixtures: workspace, mock_addin_client
├── mock_addin/
│ ├── client.py # MockAddInClient实现
│ └── response_registry.py
├── factories/
│ └── word_factories.py # 数据工厂(mimesis/polyfactory)
└── word/
└── test_*.py # Contract测试
poe test-unit # 单元测试
poe test-integration # 集成测试
poe test-contract # 契约测试
poe test-ci # CI全量测试
手动测试用于验证真实 Office 环境下的端到端功能,覆盖各种参数排列组合。
manual_tests/
├── MANUAL_TEST.md # 总体指南
├── test_word_e2e.py # 快速验证
├── test_workspace_startup.py # 启动测试
│
├── insert_text_e2e/ # word:insert:text 参数组合
│ ├── README.md # ⭐ 测试说明文档(必需)
│ ├── test_basic_insert.py # 基础插入 (4 tests)
│ ├── test_location_insert.py # 位置参数 (4 tests)
│ └── test_format_insert.py # 格式参数 (6 tests)
│
├── get_selected_content_e2e/ # word:get:selectedContent 参数组合
│ ├── README.md # ⭐ 测试说明文档(必需)
│ ├── test_basic_get.py # 基础获取 (4 tests)
│ ├── test_options_get.py # 选项参数 (5 tests)
│ └── test_edge_cases.py # 边界情况 (4 tests)
│
├── replace_selection_e2e/ # word:replace:selection 参数组合
│ ├── README.md # ⭐ 测试说明文档(必需)
│ ├── test_text_replace.py # 文本替换 (4 tests)
│ ├── test_format_replace.py # 格式替换 (4 tests)
│ └── test_edge_cases.py # 边界情况 (3 tests)
│
├── get_styles_e2e/ # word:get:styles 参数组合
│ ├── README.md # ⭐ 测试说明文档(必需)
│ └── test_styles.py # 样式获取 (5 tests)
│
└── connection_e2e/ # 连接稳定性测试
├── README.md # ⭐ 测试说明文档(必需)
├── test_reconnection.py # 重连测试
└── test_multi_document.py # 多文档测试
作用:
每个手动测试目录必须包含 README.md 文档,用于说明测试目的、运行方法和验证要点。
必要性:
内容模板(参考兄弟目录):
# <Event Name> E2E Tests
`word:<event_name>` 事件的手动端到端测试。
## 测试场景
| 测试编号 | 测试名称 | options/参数 | 描述 |
|---------|---------|-------------|------|
| 1 | 测试名称1 | `{param: value}` | 测试描述 |
| 2 | 测试名称2 | `{param: value}` | 测试描述 |
## 运行方式
### 前置条件
1. 启动 Workspace 服务器(测试会自动启动)
2. 在 Word 中加载 office-editor4ai Add-In
3. 确保文档已打开并连接
### 运行单个测试
```bash
uv run python manual_tests/<test_dir>/test_xxx.py --test 1
uv run python manual_tests/<test_dir>/test_xxx.py --test all
YYYY-MM-DD
**参考示例:**
- `manual_tests/insert_text_e2e/README.md` - 详细格式(推荐)
- `manual_tests/get_styles_e2e/README.md` - 简洁格式
### 运行方式
```bash
# 从项目根目录运行单个测试
uv run python manual_tests/<test_dir>/test_xxx.py --test 1
# 运行某目录全部测试
uv run python manual_tests/<test_dir>/test_xxx.py --test all
# 示例:运行 insert_text 基础测试
uv run python manual_tests/insert_text_e2e/test_basic_insert.py --test all
详细的测试用例设计、参数组合说明和代码模板见: