ln-782-test-runner
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseln-782-test-runner
ln-782-测试运行器
Type: L3 Worker
Category: 7XX Project Bootstrap
Parent: ln-780-bootstrap-verifier
类型: L3 Worker
类别: 7XX 项目引导组件
父组件: ln-780-bootstrap-verifier
Purpose
用途
Detects test frameworks, executes all test suites, and reports results including pass/fail counts and optional coverage.
Scope:
- Auto-detect test frameworks from project configuration
- Execute test suites for all detected frameworks
- Parse test output for pass/fail counts
- Generate coverage reports when enabled
Out of Scope:
- Building projects (handled by ln-781)
- Container operations (handled by ln-783)
- Writing or fixing tests
检测测试框架,执行所有测试套件,并生成包含通过/失败计数及可选覆盖率的测试结果报告。
适用范围:
- 从项目配置中自动检测测试框架
- 为所有检测到的框架执行测试套件
- 解析测试输出以统计通过/失败数量
- 启用时生成覆盖率报告
不适用范围:
- 项目构建(由ln-781处理)
- 容器操作(由ln-783处理)
- 编写或修复测试用例
When to Use
使用场景
| Scenario | Use This Skill |
|---|---|
| Called by ln-780 orchestrator | Yes |
| Standalone test execution | Yes |
| CI/CD pipeline test step | Yes |
| Build verification needed | No, use ln-781 |
| 场景 | 是否使用本技能 |
|---|---|
| 由ln-780编排器调用 | 是 |
| 独立执行测试 | 是 |
| CI/CD流水线测试步骤 | 是 |
| 需要构建验证 | 否,使用ln-781 |
Workflow
工作流程
Step 1: Detect Test Frameworks
步骤1:检测测试框架
Identify test frameworks from project configuration files.
| Marker | Test Framework | Project Type |
|---|---|---|
| vitest.config.* | Vitest | Node.js |
| jest.config.* | Jest | Node.js |
| *.test.ts in package.json | Vitest/Jest | Node.js |
| xunit / nunit in *.csproj | xUnit/NUnit | .NET |
| pytest.ini / conftest.py | pytest | Python |
| *_test.go files | go test | Go |
| tests/ with Cargo.toml | cargo test | Rust |
从项目配置文件中识别测试框架。
| 标识文件/配置 | 测试框架 | 项目类型 |
|---|---|---|
| vitest.config.* | Vitest | Node.js |
| jest.config.* | Jest | Node.js |
| package.json中的*.test.ts | Vitest/Jest | Node.js |
| *.csproj中的xunit / nunit | xUnit/NUnit | .NET |
| pytest.ini / conftest.py | pytest | Python |
| *_test.go文件 | go test | Go |
| 含Cargo.toml的tests/目录 | cargo test | Rust |
Step 2: Execute Test Suites
步骤2:执行测试套件
Run tests for each detected framework.
| Framework | Execution Strategy |
|---|---|
| Vitest | Run in single-run mode with JSON reporter |
| Jest | Run with JSON output |
| xUnit/NUnit | Run with logger for structured output |
| pytest | Run with JSON plugin or verbose output |
| go test | Run with JSON output flag |
| cargo test | Run with standard output parsing |
为每个检测到的框架运行测试。
| 测试框架 | 执行策略 |
|---|---|
| Vitest | 以单次运行模式执行,使用JSON报告器 |
| Jest | 执行并输出JSON格式结果 |
| xUnit/NUnit | 运行时使用日志记录器生成结构化输出 |
| pytest | 配合JSON插件执行或输出详细结果 |
| go test | 启用JSON输出标志执行 |
| cargo test | 执行并解析标准输出 |
Step 3: Parse Results
步骤3:解析测试结果
Extract test results from framework output.
| Metric | Description |
|---|---|
| total | Total number of tests discovered |
| passed | Tests that completed successfully |
| failed | Tests that failed assertions |
| skipped | Tests marked as skip/ignore |
| duration | Total execution time |
从框架输出中提取测试结果。
| 指标 | 说明 |
|---|---|
| total | 检测到的测试用例总数 |
| passed | 执行成功的测试用例数 |
| failed | 断言失败的测试用例数 |
| skipped | 标记为跳过/忽略的测试用例数 |
| duration | 总执行时长 |
Step 4: Generate Coverage (Optional)
步骤4:生成覆盖率报告(可选)
When coverage enabled, collect coverage metrics.
| Framework | Coverage Tool |
|---|---|
| Vitest/Jest | c8 / istanbul |
| .NET | coverlet |
| pytest | pytest-cov |
| Go | go test -cover |
| Rust | cargo-tarpaulin |
Coverage Metrics:
| Metric | Description |
|---|---|
| linesCovered | Lines executed during tests |
| linesTotal | Total lines in codebase |
| percentage | Coverage percentage |
启用覆盖率功能时,收集覆盖率指标。
| 测试框架 | 覆盖率工具 |
|---|---|
| Vitest/Jest | c8 / istanbul |
| .NET | coverlet |
| pytest | pytest-cov |
| Go | go test -cover |
| Rust | cargo-tarpaulin |
覆盖率指标:
| 指标 | 说明 |
|---|---|
| linesCovered | 测试期间执行的代码行数 |
| linesTotal | 代码库总行数 |
| percentage | 覆盖率百分比 |
Step 5: Report Results
步骤5:上报测试结果
Return structured results to orchestrator.
Result Structure:
| Field | Description |
|---|---|
| suiteName | Test suite identifier |
| framework | Detected test framework |
| status | passed / failed / error |
| total | Total test count |
| passed | Passed test count |
| failed | Failed test count |
| skipped | Skipped test count |
| duration | Execution time in seconds |
| failures | Array of failure details (test name, message) |
| coverage | Coverage metrics (if enabled) |
向编排器返回结构化结果。
结果结构:
| 字段 | 说明 |
|---|---|
| suiteName | 测试套件标识符 |
| framework | 检测到的测试框架 |
| status | 通过/失败/错误 |
| total | 测试用例总数 |
| passed | 通过的测试用例数 |
| failed | 失败的测试用例数 |
| skipped | 跳过的测试用例数 |
| duration | 执行时长(秒) |
| failures | 失败详情数组(测试用例名称、错误信息) |
| coverage | 覆盖率指标(若启用) |
Error Handling
错误处理
| Error Type | Action |
|---|---|
| No tests found | Report warning, status = passed (0 tests) |
| Test timeout | Report timeout, include partial results |
| Framework error | Log error, report as error status |
| Missing dependencies | Report missing test dependencies |
| 错误类型 | 处理动作 |
|---|---|
| 未找到测试用例 | 上报警告,状态标记为通过(0个测试用例) |
| 测试超时 | 上报超时,包含部分测试结果 |
| 框架执行错误 | 记录错误,状态标记为错误 |
| 依赖缺失 | 上报缺失的测试依赖 |
Options
配置选项
| Option | Default | Description |
|---|---|---|
| skipTests | false | Skip execution if no tests found |
| allowFailures | false | Report success even if tests fail |
| coverage | false | Generate coverage report |
| timeout | 300 | Max execution time in seconds |
| parallel | true | Run test suites in parallel when possible |
| 选项 | 默认值 | 说明 |
|---|---|---|
| skipTests | false | 未找到测试用例时跳过执行 |
| allowFailures | false | 即使测试失败也上报成功状态 |
| coverage | false | 生成覆盖率报告 |
| timeout | 300 | 最大执行时长(秒) |
| parallel | true | 尽可能并行运行测试套件 |
Critical Rules
核心规则
- Run all detected test suites - do not skip suites silently
- Parse actual results - do not rely only on exit code
- Include failure details - provide actionable information for debugging
- Respect timeout - prevent hanging on infinite loops
- 执行所有检测到的测试套件 - 不得静默跳过任何套件
- 解析实际测试结果 - 不得仅依赖退出码
- 包含失败详情 - 提供可用于调试的有效信息
- 遵守超时限制 - 避免因无限循环导致挂起
Definition of Done
完成标准
- All test frameworks detected
- All test suites executed
- Results parsed and structured
- Coverage collected (if enabled)
- Results returned to orchestrator
Version: 2.0.0
Last Updated: 2026-01-10
- 所有测试框架已检测
- 所有测试套件已执行
- 测试结果已解析并结构化
- 已收集覆盖率数据(若启用)
- 结果已返回给编排器
版本: 2.0.0
最后更新时间: 2026-01-10