mcpField
P
parallel-test-fixing

parallel-test-fixing

github.com/spencerpauly测试与质量868418 次安装13 周前更新
代码仓库

关于 parallel-test-fixing

一项将失败测试按文件拆分并交由并行子 Agent 修复的技能,最后重新运行测试套件验证结果,适用于处理多处测试失败的开发者。

主要功能

  1. 01按文件归类失败测试
  2. 02将文件分配给并行子 Agent
  3. 03汇总修改及冲突风险
  4. 04重新运行测试验证修复

适用场景

  1. 01梳理多个失败的测试文件
  2. 02并行修复相互独立的问题
  3. 03检查并行修改后的冲突

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/spencerpauly/awesome-cursor-skills --skill parallel-test-fixing

安装后在 Claude Code 中输入/parallel-test-fixing确认已加载。

详细介绍

并行修复测试

通过将失败的测试分配给多个并行子 Agent,加快修复损坏测试套件的速度。

工作流

1. 运行完整测试套件
npm test -- --no-coverage 2>&1 || true

捕获输出并提取所有失败的测试文件。

2. 对失败项分组

解析测试输出,找出失败的文件:

  • Jest:FAIL src/components/Button.test.tsx
  • Vitest:FAIL src/utils/format.test.ts
  • Pytest:FAILED tests/test_api.py::test_create_user

按文件分组——每个文件对应一个任务。

3. 启动并行子 Agent

为每个失败的测试文件启动一个 generalPurpose 子 Agent:

Task: Fix the failing tests in <file>

The test file is: <path>
The test command is: <command to run just this file>
The error output was:
<paste the relevant failure output>

Steps:
1. Read the test file and the source file it tests
2. Understand why each test is failing
3. Fix the source code (preferred) or update the test if the test is wrong
4. Run the single test file to confirm it passes
5. Report what you changed and why

同时启动所有子 Agent——由于每个子 Agent 都会修改不同的文件,因此可以并行工作。

4. 收集结果

每个子 Agent 完成后,收集以下信息:

  • 修复了哪些测试
  • 修改了哪些文件
  • 修复是否可能与其他子 Agent 的修改冲突
5. 验证

再次运行完整测试套件,确认所有测试均通过:

npm test

如果出现新的失败(由冲突的修复导致),请依次解决。

提示

  • 如果两个失败的测试共用同一个源文件,请将它们分配给同一个子 Agent,以避免编辑冲突
  • 设置超时时间——如果子 Agent 卡住 5 分钟以上,请检查其进度
  • 对于大型测试套件(失败项超过 50 个),按每个子 Agent 5~10 个失败项分批处理,而不是每个文件分配一个子 Agent
  • 如果希望每次修复尝试都使用独立的工作树,请使用 best-of-n-runner 子 Agent

评论

支持 Markdown