Loading...
Loading...
Compare original and translation side by side
为 src/lib/ui 模块创建单元测试为 MyClass 生成测试为 MyClass 补全测试qt-unittest-buildsystematic-debuggingCreate unit tests for the src/lib/ui moduleGenerate tests for MyClassComplete tests for MyClassqt-unittest-buildsystematic-debuggingautotests/CMakeLists.txtautotests/3rdparty/stub/qt-unittest-buildautotests/CMakeLists.txtautotests/3rdparty/stub/qt-unittest-build.h/.hpplsp_document_symbolslsp_goto_definitionlsp_find_references.h/.hpplsp_document_symbolslsp_goto_definitionlsp_find_referencesagent/unittest-generator.mdtasktask(
description="生成单元测试代码",
prompt="完整的任务说明,包括:
- 目标模块或类
- 测试框架要求(Google Test)
- 函数覆盖率要求(100%)
- 验证构建要求",
subagent_type="general"
)agent/unittest-generator.mdtasktask(
description="Generate unit test code",
prompt="Complete task description including:
- Target module or class
- Testing framework requirement (Google Test)
- Function coverage requirement (100%)
- Build verification requirement",
subagent_type="general"
)test_myclass.cppMyClassTest{Feature}_{Scenario}_{ExpectedResult}lsp_document_symbolslsp_goto_definitionlsp_find_references&Class::methodVADDR(Class, method)static_cast<...>test_myclass.cppMyClassTest{Feature}_{Scenario}_{ExpectedResult}lsp_document_symbolslsp_goto_definitionlsp_find_references&Class::methodVADDR(Class, method)static_cast<...>task(
description="生成单元测试代码",
prompt="完整任务描述,包括目标、要求、验证流程",
subagent_type="general"
)tasktask(
description="Generate unit test code",
prompt="Complete task description including target, requirements, and verification process",
subagent_type="general"
)| 错误 | 原因 | 修复 |
|---|---|---|
| 测试框架不存在 | 未运行 qt-unittest-build | 提示用户先运行框架构建技能 |
| 覆盖率不足 | 未分析所有函数 | 确保 lsp_document_symbols 提取完整 |
| CMake 合并失败 | 硬编码模板 | 使用 AI 智能合并,根据项目实际情况优化 |
| 编译失败 | Stub 签名错误 | 使用 LSP 获取精确签名 |
| 编译失败仍报告完成 | 跳过验证或验证不严谨 | 必须编译成功才能报告用户 |
| 多个错误未修正 | 全局重试 3 次不足 | 每个错误重试 3 次,最大循环 10 次 |
| Error | Cause | Fix |
|---|---|---|
| Testing framework not found | | Prompt user to run the framework build skill first |
| Insufficient coverage | All functions not analyzed | Ensure |
| CMake merging failed | Hard-coded templates | Use AI for smart merging, optimize based on actual project conditions |
| Compilation failed | Incorrect stub signature | Use LSP to obtain precise signatures |
| Report completion despite compilation failure | Verification skipped or not rigorous | Must only report to user after successful compilation |
| Multiple errors not fixed | Global 3 retries insufficient | Retry each error up to 3 times, not 3 global retries |
| Excuse | Reality |
|---|---|
| "直接手动工作更快" | 手动工作无法保证 100% 覆盖率和构建验证,子 Agent 是强制要求 |
| "跳过子 Agent 调用" | 违反技能的铁律,必须调用子 Agent |
| "编译失败也可以报告完成" | 违反强制构建验证要求,必须编译成功才能报告 |
| "全局重试 3 次就够了" | 每个错误重试 3 次,不是全局 3 次 |
| "覆盖率 80% 就可以了" | 铁律要求 100% 函数覆盖率,无例外 |
| "Qt Test 也一样" | 技能固定使用 Google Test,不支持 Qt Test |
| Excuse | Reality |
|---|---|
| "Manual work is faster directly" | Manual work cannot guarantee 100% coverage and build verification; sub-agents are mandatory |
| "Skip sub-agent invocation" | Violates the skill's iron laws; sub-agent invocation is mandatory |
| "Can report completion even if compilation fails" | Violates mandatory build verification requirements; must only report after successful compilation |
| "3 global retries are enough" | Retry each error up to 3 times, not 3 global retries |
| "80% coverage is sufficient" | Iron law requires 100% function coverage, no exceptions |
| "Qt Test is the same" | The skill is fixed to use Google Test; Qt Test is not supported |