run-tests
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRun Tests
运行测试
Test execution with parallel analysis agents for failures.
借助并行分析Agent执行测试,用于排查故障。
Quick Start
快速开始
bash
/run-tests
/run-tests backend
/run-tests frontend
/run-tests tests/unit/test_auth.pybash
/run-tests
/run-tests backend
/run-tests frontend
/run-tests tests/unit/test_auth.pyTest Scope
测试范围
| Argument | Scope |
|---|---|
Empty/ | All tests |
| Backend only |
| Frontend only |
| Specific file |
| Specific test |
| 参数 | 测试范围 |
|---|---|
无/ | 所有测试 |
| 仅后端 |
| 仅前端 |
| 指定文件 |
| 指定测试用例 |
Phase 1: Execute Tests
阶段1:执行测试
bash
undefinedbash
undefinedBackend with coverage
带覆盖率统计的后端测试
cd backend
poetry run pytest tests/unit/ -v --tb=short
--cov=app --cov-report=term-missing
--cov=app --cov-report=term-missing
cd backend
poetry run pytest tests/unit/ -v --tb=short
--cov=app --cov-report=term-missing
--cov=app --cov-report=term-missing
Frontend with coverage
带覆盖率统计的前端测试
cd frontend
npm run test -- --coverage
undefinedcd frontend
npm run test -- --coverage
undefinedPhase 2: Failure Analysis
阶段2:故障分析
If tests fail, launch 3 parallel analyzers:
- Backend Failure Analysis - Root cause, fix suggestions
- Frontend Failure Analysis - Component issues, mock problems
- Coverage Gap Analysis - Low coverage areas
如果测试失败,启动3个并行分析器:
- 后端故障分析 - 根本原因、修复建议
- 前端故障分析 - 组件问题、Mock问题
- 覆盖率缺口分析 - 低覆盖率区域
Phase 3: Generate Report
阶段3:生成报告
markdown
undefinedmarkdown
undefinedTest Results Report
测试结果报告
Summary
摘要
| Suite | Total | Passed | Failed | Coverage |
|---|---|---|---|---|
| Backend | X | Y | Z | XX% |
| Frontend | X | Y | Z | XX% |
| 测试套件 | 总数 | 通过数 | 失败数 | 覆盖率 |
|---|---|---|---|---|
| 后端 | X | Y | Z | XX% |
| 前端 | X | Y | Z | XX% |
Status: [ALL PASS | SOME FAILURES]
状态: [全部通过 | 部分失败]
Failures (if any)
失败用例(如有)
| Test | Error | Fix |
|---|---|---|
| test_name | AssertionError | [suggestion] |
undefined| 测试用例 | 错误信息 | 修复建议 |
|---|---|---|
| test_name | AssertionError | [建议内容] |
undefinedQuick Commands
快速命令
bash
undefinedbash
undefinedAll backend tests
所有后端测试
poetry run pytest tests/unit/ -v --tb=short
poetry run pytest tests/unit/ -v --tb=short
With coverage
带覆盖率统计
poetry run pytest tests/unit/ --cov=app
poetry run pytest tests/unit/ --cov=app
Quick (no tracebacks)
快速模式(无回溯信息)
poetry run pytest tests/unit/ --tb=no -q
poetry run pytest tests/unit/ --tb=no -q
Specific test
指定测试用例
poetry run pytest tests/unit/ -k "test_name" -v
poetry run pytest tests/unit/ -k "test_name" -v
Frontend
前端测试
npm run test -- --coverage
npm run test -- --coverage
Watch mode
监听模式
npm run test -- --watch
undefinednpm run test -- --watch
undefinedKey Options
关键选项
| Option | Purpose |
|---|---|
| Stop after 3 failures |
| Stop on first failure |
| Run only last failed |
| Verbose output |
| Shorter tracebacks |
| 选项 | 用途 |
|---|---|
| 失败3次后停止 |
| 首次失败即停止 |
| 仅运行上次失败的用例 |
| 详细输出 |
| 简短回溯信息 |
Related Skills
相关技能
- - Unit test patterns and best practices
unit-testing - - Integration test patterns for component interactions
integration-testing - - End-to-end testing with Playwright
e2e-testing - - Test data fixtures and factories
test-data-management
- - 单元测试模式与最佳实践
unit-testing - - 组件交互的集成测试模式
integration-testing - - 基于Playwright的端到端测试
e2e-testing - - 测试数据夹具与工厂
test-data-management
Key Decisions
关键决策
| Decision | Choice | Rationale |
|---|---|---|
| Parallel Analyzers | 3 agents | Backend, frontend, and coverage analysis in parallel |
| Default Traceback | | Balance between detail and readability |
| Stop Threshold | | Quick feedback without overwhelming output |
| Coverage Tool | pytest-cov / jest | Native integration with test frameworks |
| 决策项 | 选择方案 | 理由 |
|---|---|---|
| 并行分析器数量 | 3个Agent | 同时进行后端、前端和覆盖率分析 |
| 默认回溯模式 | | 在详细程度和可读性之间取得平衡 |
| 停止阈值 | | 快速反馈,避免输出过载 |
| 覆盖率工具 | pytest-cov / jest | 与测试框架原生集成 |
References
参考资料
- Test Commands
- 测试命令