java/src/main/resources/targets/claude/skills/core/test/x-test-run/SKILL.md
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.
npx skillsauth add edercnj/claude-environment x-test-runInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
# 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
| Metric | Minimum | | --------------- | ------- | | Line Coverage | >= 95% | | Branch Coverage | >= 90% |
For full testing philosophy (8 test categories, data uniqueness, fixture patterns), read knowledge/testing/testing-philosophy.md.
[methodUnderTest]_[scenario]_[expectedBehavior]
Examples:
processTransaction_approvedAmount_returnsSuccessfindById_nonExistent_returnsEmptyvalidate_nullInput_throwsExceptionEvery test method follows AAA with clear separation:
// Arrange -- setup objects and data
// Act -- execute the method under test
// Assert -- verify the outcome
| 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 |
After running {{COVERAGE_COMMAND}}, analyze the coverage report.
| 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 |
+--------------------------+-------+--------+
| 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
Read knowledge/testing/testing-conventions.md for {{LANGUAGE}}-specific test frameworks and assertion libraries.
assertThatThrownBy or equivalentisPresent()/isEmpty()Centralize test data in utility classes:
final class + private constructor + static methodsa{Entity}() or a{Entity}With{Variation}()Tests that create resources (POST/INSERT) MUST generate unique identifiers to avoid conflicts between test runs.
When invoked with --traceability [STORY-ID|EPIC-ID], generates a bidirectional requirement-to-test mapping report.
# Single story traceability
/x-test-run --traceability STORY-0007-0003
# Epic-wide traceability (consolidates all stories)
/x-test-run --traceability EPIC-0007
Generates results/traceability/traceability-{ID}-{YYYY-MM-DD}.md containing:
# 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
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.
x-story-implement during Phase 2 (G7) and Phase 4x-task-implement during Step 4x-review skill (QA engineer)x-lib-group-verifier in G7 verificationtools
Documentation automation v2: stack-aware generation from documentation.targets.
development
Generates or updates CI/CD pipelines per project stack with actionlint validation.
tools
Generates ADRs from architecture-plan mini-ADRs with sequential numbering and index update.
development
Formats source code; first step of the pre-commit chain (format -> lint -> compile).