霍格沃兹测试开发学社
08-15 · 北京测吧
Opencode最被低估的6个测试指令二
二、6条最被低估的测试指令指令一:/test —— 一键跑全量测试 + 自动修失败做什么: 跑完整套测试,生成覆盖率报告,自动分析失败的测试并给出修复建议。什么时候用: 每次代码修改后,想快速确认有没有破坏现有功能。怎么配: 在.opencode/commands/test.md创建文件:---description: Run tests with coverage and triage failuresagent: build---Run the full test suite with coverage report and show any failures.Focus on the failing tests and suggest precise fixes.真实效果: 我们团队有个模块的测试套件有800多条用例。以前每次跑完要人工翻日志找失败原因,现在输入/test,AI自动跑完、自动分析、自动给出修复建议。原来45分钟的工作,现在2分钟。指令二:/coverage —— 精准定位未覆盖代码做什么: 分析覆盖率报告,列出所有未覆盖的文件、函数和分支。什么时候用: 想知道"还有哪些代码没被测试覆盖到"。怎么配:---description: Analyze test coverage gapsagent: plan---Here are the current test results:!`npm test -- --coverage --reporter=json`Based on these results:1. List all files with coverage below 80%2. For each file, show which functions or branches are not covered3. Prioritize gaps by risk (core business logic > utilities > configs)4. Suggest which files should be prioritized for new tests
发布于 江苏
1
评论
未登录
友善发言
image-upload
评论
加载中