ln-782-test-runner

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

ln-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

使用场景

ScenarioUse This Skill
Called by ln-780 orchestratorYes
Standalone test executionYes
CI/CD pipeline test stepYes
Build verification neededNo, use ln-781

场景是否使用本技能
由ln-780编排器调用
独立执行测试
CI/CD流水线测试步骤
需要构建验证否,使用ln-781

Workflow

工作流程

Step 1: Detect Test Frameworks

步骤1:检测测试框架

Identify test frameworks from project configuration files.
MarkerTest FrameworkProject Type
vitest.config.*VitestNode.js
jest.config.*JestNode.js
*.test.ts in package.jsonVitest/JestNode.js
xunit / nunit in *.csprojxUnit/NUnit.NET
pytest.ini / conftest.pypytestPython
*_test.go filesgo testGo
tests/ with Cargo.tomlcargo testRust
从项目配置文件中识别测试框架。
标识文件/配置测试框架项目类型
vitest.config.*VitestNode.js
jest.config.*JestNode.js
package.json中的*.test.tsVitest/JestNode.js
*.csproj中的xunit / nunitxUnit/NUnit.NET
pytest.ini / conftest.pypytestPython
*_test.go文件go testGo
含Cargo.toml的tests/目录cargo testRust

Step 2: Execute Test Suites

步骤2:执行测试套件

Run tests for each detected framework.
FrameworkExecution Strategy
VitestRun in single-run mode with JSON reporter
JestRun with JSON output
xUnit/NUnitRun with logger for structured output
pytestRun with JSON plugin or verbose output
go testRun with JSON output flag
cargo testRun 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.
MetricDescription
totalTotal number of tests discovered
passedTests that completed successfully
failedTests that failed assertions
skippedTests marked as skip/ignore
durationTotal execution time
从框架输出中提取测试结果。
指标说明
total检测到的测试用例总数
passed执行成功的测试用例数
failed断言失败的测试用例数
skipped标记为跳过/忽略的测试用例数
duration总执行时长

Step 4: Generate Coverage (Optional)

步骤4:生成覆盖率报告(可选)

When coverage enabled, collect coverage metrics.
FrameworkCoverage Tool
Vitest/Jestc8 / istanbul
.NETcoverlet
pytestpytest-cov
Gogo test -cover
Rustcargo-tarpaulin
Coverage Metrics:
MetricDescription
linesCoveredLines executed during tests
linesTotalTotal lines in codebase
percentageCoverage percentage
启用覆盖率功能时,收集覆盖率指标。
测试框架覆盖率工具
Vitest/Jestc8 / istanbul
.NETcoverlet
pytestpytest-cov
Gogo test -cover
Rustcargo-tarpaulin
覆盖率指标:
指标说明
linesCovered测试期间执行的代码行数
linesTotal代码库总行数
percentage覆盖率百分比

Step 5: Report Results

步骤5:上报测试结果

Return structured results to orchestrator.
Result Structure:
FieldDescription
suiteNameTest suite identifier
frameworkDetected test framework
statuspassed / failed / error
totalTotal test count
passedPassed test count
failedFailed test count
skippedSkipped test count
durationExecution time in seconds
failuresArray of failure details (test name, message)
coverageCoverage metrics (if enabled)

向编排器返回结构化结果。
结果结构:
字段说明
suiteName测试套件标识符
framework检测到的测试框架
status通过/失败/错误
total测试用例总数
passed通过的测试用例数
failed失败的测试用例数
skipped跳过的测试用例数
duration执行时长(秒)
failures失败详情数组(测试用例名称、错误信息)
coverage覆盖率指标(若启用)

Error Handling

错误处理

Error TypeAction
No tests foundReport warning, status = passed (0 tests)
Test timeoutReport timeout, include partial results
Framework errorLog error, report as error status
Missing dependenciesReport missing test dependencies

错误类型处理动作
未找到测试用例上报警告,状态标记为通过(0个测试用例)
测试超时上报超时,包含部分测试结果
框架执行错误记录错误,状态标记为错误
依赖缺失上报缺失的测试依赖

Options

配置选项

OptionDefaultDescription
skipTestsfalseSkip execution if no tests found
allowFailuresfalseReport success even if tests fail
coveragefalseGenerate coverage report
timeout300Max execution time in seconds
paralleltrueRun test suites in parallel when possible

选项默认值说明
skipTestsfalse未找到测试用例时跳过执行
allowFailuresfalse即使测试失败也上报成功状态
coveragefalse生成覆盖率报告
timeout300最大执行时长(秒)
paralleltrue尽可能并行运行测试套件

Critical Rules

核心规则

  1. Run all detected test suites - do not skip suites silently
  2. Parse actual results - do not rely only on exit code
  3. Include failure details - provide actionable information for debugging
  4. Respect timeout - prevent hanging on infinite loops

  1. 执行所有检测到的测试套件 - 不得静默跳过任何套件
  2. 解析实际测试结果 - 不得仅依赖退出码
  3. 包含失败详情 - 提供可用于调试的有效信息
  4. 遵守超时限制 - 避免因无限循环导致挂起

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