Skip to content
Development
Command

/test

运行测试并分析结果,失败时提供修复建议

From plugin
claude-code-engineering
1.1k11 skills16 agents11 commands
Install
$ npx -y skills add huangjia2019/claude-code-engineering --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/test

Context preview

What this command does when you run it.

运行测试并分析结果,失败时提供修复建议

Command definition

test.md
name: test
description: 运行测试并分析结果,失败时提供修复建议

用法:`/test [scope] [options]`

参数

  • `scope`(可选):
  • `unit` - 只运行单元测试
  • `e2e` - 只运行端到端测试
  • `all` - 运行全部(默认)
  • `options`:
  • `--fix` - 尝试自动修复失败的测试
  • `--coverage` - 生成覆盖率报告

工作流程

1. 运行指定范围的测试 2. 收集测试结果 3. 对失败的测试:

  • 分析失败原因
  • 检查是代码 bug 还是测试过时
  • 提供修复建议

4. 如果指定了 --fix,尝试自动修复

输出格式

# 测试报告

## 结果

| 指标 | 值 |
|------|------|
| 总计 | 150 |
| 通过 | 147 |
| 失败 | 3 |
| 跳过 | 0 |
| 覆盖率 | 85% |

## 失败的测试

### test_user_creation
**文件**: tests/user.test.ts:42
**错误**: AssertionError: expected 'active' but got 'pending'

**分析**: User 模型的默认状态在 commit abc123 中从 'active' 改为 'pending',但测试未更新。

**建议**: 更新测试以期望 'pending' 状态。

\`\`\`diff
- expect(user.status).toBe('active');
+ expect(user.status).toBe('pending');
\`\`\`

---
*由 team-toolkit 生成*
Ships withclaude-code-engineering

This repository demonstrates how to use Claude Code to do real engineering work, not just writing code. 本项目是极客时间专栏 《Claude Code 工程化实战》 的官方配套示例仓库,目标就是: 👉 把 Claude Code 从“对话式编码工具”,变成 可设计、可复用、可治理的工程系统。

Get the whole plugin, auto-invoked
Stats
1,050
Stars
0
Views
373
Forks
Active
Maintenance
JavaScript
Language
16d ago
Last commit
6mo ago
Created

Repo: huangjia2019/claude-code-engineering