run-tests

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Run 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.py
bash
/run-tests
/run-tests backend
/run-tests frontend
/run-tests tests/unit/test_auth.py

Test Scope

测试范围

ArgumentScope
Empty/
all
All tests
backend
Backend only
frontend
Frontend only
path/to/test.py
Specific file
test_name
Specific test
参数测试范围
无/
all
所有测试
backend
仅后端
frontend
仅前端
path/to/test.py
指定文件
test_name
指定测试用例

Phase 1: Execute Tests

阶段1:执行测试

bash
undefined
bash
undefined

Backend with coverage

带覆盖率统计的后端测试

cd backend poetry run pytest tests/unit/ -v --tb=short
--cov=app --cov-report=term-missing
cd backend poetry run pytest tests/unit/ -v --tb=short
--cov=app --cov-report=term-missing

Frontend with coverage

带覆盖率统计的前端测试

cd frontend npm run test -- --coverage
undefined
cd frontend npm run test -- --coverage
undefined

Phase 2: Failure Analysis

阶段2:故障分析

If tests fail, launch 3 parallel analyzers:
  1. Backend Failure Analysis - Root cause, fix suggestions
  2. Frontend Failure Analysis - Component issues, mock problems
  3. Coverage Gap Analysis - Low coverage areas
如果测试失败,启动3个并行分析器:
  1. 后端故障分析 - 根本原因、修复建议
  2. 前端故障分析 - 组件问题、Mock问题
  3. 覆盖率缺口分析 - 低覆盖率区域

Phase 3: Generate Report

阶段3:生成报告

markdown
undefined
markdown
undefined

Test Results Report

测试结果报告

Summary

摘要

SuiteTotalPassedFailedCoverage
BackendXYZXX%
FrontendXYZXX%
测试套件总数通过数失败数覆盖率
后端XYZXX%
前端XYZXX%

Status: [ALL PASS | SOME FAILURES]

状态: [全部通过 | 部分失败]

Failures (if any)

失败用例(如有)

TestErrorFix
test_nameAssertionError[suggestion]
undefined
测试用例错误信息修复建议
test_nameAssertionError[建议内容]
undefined

Quick Commands

快速命令

bash
undefined
bash
undefined

All 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
undefined
npm run test -- --watch
undefined

Key Options

关键选项

OptionPurpose
--maxfail=3
Stop after 3 failures
-x
Stop on first failure
--lf
Run only last failed
-v
Verbose output
--tb=short
Shorter tracebacks
选项用途
--maxfail=3
失败3次后停止
-x
首次失败即停止
--lf
仅运行上次失败的用例
-v
详细输出
--tb=short
简短回溯信息

Related Skills

相关技能

  • unit-testing
    - Unit test patterns and best practices
  • integration-testing
    - Integration test patterns for component interactions
  • e2e-testing
    - End-to-end testing with Playwright
  • test-data-management
    - Test data fixtures and factories
  • unit-testing
    - 单元测试模式与最佳实践
  • integration-testing
    - 组件交互的集成测试模式
  • e2e-testing
    - 基于Playwright的端到端测试
  • test-data-management
    - 测试数据夹具与工厂

Key Decisions

关键决策

DecisionChoiceRationale
Parallel Analyzers3 agentsBackend, frontend, and coverage analysis in parallel
Default Traceback
--tb=short
Balance between detail and readability
Stop Threshold
--maxfail=3
Quick feedback without overwhelming output
Coverage Toolpytest-cov / jestNative integration with test frameworks
决策项选择方案理由
并行分析器数量3个Agent同时进行后端、前端和覆盖率分析
默认回溯模式
--tb=short
在详细程度和可读性之间取得平衡
停止阈值
--maxfail=3
快速反馈,避免输出过载
覆盖率工具pytest-cov / jest与测试框架原生集成

References

参考资料

  • Test Commands
  • 测试命令