x-execute-tests
Runs tests with coverage reporting and threshold validation. Use whenever writing, running, or analyzing tests. Triggers on: test, coverage, TDD, unit test, integration test, test failure, coverage gap, or Definition of Done validation.
- License 许可
- MIT
- 最近更新
- 2026-10-27
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- x-execute-tests
- description
- Runs tests with coverage reporting and threshold validation. Use whenever writing, running, or analyzing tests. Triggers on: test, coverage, TDD, unit test, integration test, test failure, coverage gap, or Definition of Done validation.
- allowed-tools
- Read, Write, Edit, Bash, Grep, Glob
- argument-hint
- [ClassName or package or --coverage]
- context-budget
- light
- requires-capabilities
- []
02 资源文件 1
- 参考文档README.md1.7 KB
03 SKILL.md 正文
Global Output Policy
- Language: English ONLY.
- Tone: Technical, Direct, and Concise.
- Efficiency: Remove all conversational fillers and greetings to save tokens.
Skill: Run Tests
Purpose
Testing is critical in {{PROJECT_NAME}}. The project enforces strict coverage thresholds (line >= 95%, branch >= 90%). This skill guides test execution, coverage analysis, and gap identification.
Test Execution Commands
# All tests
{{TEST_COMMAND}}
# With coverage report
{{COVERAGE_COMMAND}}
# Specific test class (adapt to your build tool)
# Example: mvn test -Dtest=ClassName
# Example: ./gradlew test --tests ClassName
Coverage Thresholds
| Metric | Minimum |
|---|---|
| Line Coverage | >= 95% |
| Branch Coverage | >= 90% |
Test Structure
For full testing philosophy (8 test categories, data uniqueness, fixture patterns), read knowledge/testing/testing-philosophy.md.
Naming Convention
[methodUnderTest]_[scenario]_[expectedBehavior]
Examples:
processTransaction_approvedAmount_returnsSuccessfindById_nonExistent_returnsEmptyvalidate_nullInput_throwsException
Test Pattern (Arrange-Act-Assert)
Every test method follows AAA with clear separation:
// Arrange -- setup objects and data
// Act -- execute the method under test
// Assert -- verify the outcome
Test Categories
| Category | When to Use | Tools |
|---|---|---|
| Unit | Domain logic, engines, mappers | Test framework + assertions |
| Integration | DB interactions, framework features | Framework test support |
| API | REST endpoints | HTTP test client |
| E2E | Full flow (request -> process -> persist -> response) | Integration framework |
| Contract | Protocol/format compliance | Parametrized tests |
| Performance | Latency SLAs, throughput | Load testing framework |
Coverage Analysis
After running {{COVERAGE_COMMAND}}, analyze the coverage report.
Common Coverage Gaps and Solutions
| Gap | Solution |
|---|---|
Uncovered else branch |
Add test for the negative case |
| Uncovered exception path | Test error paths with exception assertions |
Uncovered default in switch |
Add test with unexpected input |
| Uncovered record accessor | Usually covered indirectly; add direct test if not |
| Uncovered validation | Test with invalid inputs |
Per-Class Coverage Report Format
+--------------------------+-------+--------+
| Class | Line | Branch |
+--------------------------+-------+--------+
| ClassA | 100% | 95.0% |
+--------------------------+-------+--------+
| ClassB | 97.3% | 88.5% |
+--------------------------+-------+--------+
Tests: XX passing, XX failing, XX errors, XX skipped
Global Coverage: XX% line / XX% branch
Assertion Rules
Read knowledge/testing/testing-conventions.md for {{LANGUAGE}}-specific test frameworks and assertion libraries.
- Use the project's standard assertion library (e.g., AssertJ, Hamcrest)
- NEVER use basic assertEquals/assertTrue if a fluent assertion library is available
- Test exception paths with
assertThatThrownByor equivalent - Test Optional results with
isPresent()/isEmpty()
Test Data
Fixture Pattern
Centralize test data in utility classes:
final class+privateconstructor +staticmethods- Naming:
a{Entity}()ora{Entity}With{Variation}() - Constants for default values
- Domain fixtures separate from protocol/format fixtures
Data Uniqueness
Tests that create resources (POST/INSERT) MUST generate unique identifiers to avoid conflicts between test runs.
Traceability Matrix (--traceability flag)
When invoked with --traceability [STORY-ID|EPIC-ID], generates a bidirectional requirement-to-test mapping report.
Usage
# Single story traceability
/x-execute-tests --traceability STORY-0007-0003
# Epic-wide traceability (consolidates all stories)
/x-execute-tests --traceability EPIC-0007
Output
Generates results/traceability/traceability-{ID}-{YYYY-MM-DD}.md containing:
- Requirement -> Test -> Execution table mapping each @GK-N scenario to its test class, method, status (PASS/FAIL/SKIP), and line coverage
- Unmapped Requirements — scenarios with no corresponding test
- Unmapped Tests — test methods not linked to any story scenario
- Coverage Summary — stories covered, scenarios covered, pass/skip/fail counts
Traceability Matrix Format
# Traceability Matrix — STORY-XXXX-YYYY
Generated: YYYY-MM-DD | Build: <commit-hash>
## Requirement -> Test -> Execution
| Req ID | Scenario | Test Class | Method | Status | Line Cov |
|--------|----------|------------|--------|--------|----------|
| AT-1 | scenario | TestClass | method | PASS | 94% |
## Unmapped Requirements
- AT-N: description
## Unmapped Tests
- TestClass.method -> not linked to any story scenario
## Coverage Summary
- Stories covered: N/M
- Scenarios covered: N/M (X%)
- Scenarios PASS: N | SKIP: N | FAIL: N
Epic Consolidation
For EPIC-ID, the matrix consolidates all stories in the epic with one section per story and a global summary at the end with aggregated totals.
Integration Notes
- Invoked by
x-implement-storyduring Phase 2 (G7) and Phase 4 - Invoked by
x-implement-taskduring Step 4 - Coverage report consumed by
x-review-codebaseskill (QA engineer) - Thresholds enforced by
x-lib-verify-groupin G7 verification
04 同仓库更多 Skills
x-parallel-eval
Detects and classifies file-collision risks between work units (tasks, stories, or epic phases) before parallel execution. Reads ## File Footprint blocks produced by x-task-plan / x-story-plan, applies the parallelism-heuristics knowledge pack (hard / regen / soft categories + hotspot overrides), and emits a collision matrix + serialization recommendation in Markdown (default) or JSON.
parallelism-heuristics
Canonical catalog of file-collision heuristics for parallel task, story, and epic execution. Defines the File Footprint block format, the three Conflict Categories (hard / regen / soft), a hotspot list of high-contention paths, and the degrade-with-warning policy. Consumed by x-task-plan, x-story-plan, x-epic-map, x-parallel-eval, and x-dev-*-implement.
x-watch-pr-ci
Polls a PR's CI checks and Copilot review status, blocking until checks complete or timeout. Returns one of 8 stable exit codes (SUCCESS=0, CI_PENDING_PROCEED=10, CI_FAILED=20, TIMEOUT=30, PR_ALREADY_MERGED=40, NO_CI_CONFIGURED=50, PR_CLOSED=60, PR_NOT_FOUND=70). Writes a versioned state-file for session resume.
x-validate-docs
Documentation freshness gate: validates 6 dimensions (readme, api-specs, grpc-proto, adr, skill-docs, system-architecture) against code changes in a PR. Stack-aware — only validates targets declared/auto-detected from ProjectConfig.documentation.targets. Returns exit non-zero on staleness; produces structured report.
x-update-system-architecture
Incrementally updates docs/architecture/system.md after an epic completes. Appends new entries to the Decision Log (§11) using x-internal-write-report --append (dedup by ## ID: marker) and surgically inserts component/integration changes into sections 1-10 via Edit. Idempotent: re-running with the same epic produces a byte-identical system.md.
x-update-architecture
Incrementally updates the service architecture document with changes from architecture plans. Adds new components, integrations, flows, and ADR references without rewriting existing content. Use after implementation to keep architecture documentation current.