Run Tests
Execute the project's test suite, analyze failures, attempt fixes, and re-run. Designed as a reusable follow-up skill called by feature-dev skill, bugfix skill, and pre-commit skill.
Uses test-strategy skill for test writing patterns and coverage targets.
1. Detect Test Stack
Read TESTING.md (if exists) for test commands, infrastructure, and credentials. Fall back to AGENTS.md and project config to determine:
| Signal |
Stack |
Runner |
package.json + vitest/jest |
TypeScript/JS |
npx vitest run / npx jest |
pom.xml / build.gradle |
Java |
mvn test -q / gradle test |
pyproject.toml / pytest.ini |
Python |
pytest -x -q |
go.mod |
Go |
go test ./... |
*.csproj |
.NET |
dotnet test |
2. Run Tests
Execute the test suite:
// turbo
<test-command>
Capture:
- Exit code: 0 = all pass, non-zero = failures
- Output: Test names, pass/fail counts, error messages, stack traces
3. Analyze Failures
If tests fail, for each failure:
- Read the failing test — understand what it asserts
- Read the error message and stack trace — identify the actual vs expected
- Classify the failure:
| Classification |
Action |
| Code bug — test is correct, implementation is wrong |
Fix the implementation (Step 4) |
| Test bug — test is wrong or outdated |
Fix the test (Step 4) |
| Environment issue — missing dependency, port conflict, DB down |
Report to user (Step 5) |
| Flaky test — passes on re-run without changes |
Flag for investigation |
4. Fix and Re-Run
For auto-fixable failures:
- Apply the appropriate stack-specific role (
frontend-engineer role, java-engineer role, python-engineer role, etc.)
- Apply the minimal fix — do not refactor unrelated code
- Re-run the failing test(s) specifically:
| Stack |
Run Single Test |
| Vitest |
npx vitest run <test-file> |
| Jest |
npx jest <test-file> |
| pytest |
pytest <test-file>::<test-name> -v |
| JUnit/Maven |
mvn test -pl <module> -Dtest=<TestClass>#<method> |
| Go |
go test -run <TestName> ./path/... |
- If the fix works, re-run the full suite to check for regressions
- Max 3 fix attempts per failure — if still failing after 3 tries, escalate to user
5. Coverage Check (if available)
Run coverage report:
| Stack |
Command |
| Vitest |
npx vitest run --coverage |
| Jest |
npx jest --coverage |
| pytest |
pytest --cov=<package> --cov-report=term-missing |
| Go |
go test -coverprofile=coverage.out ./... && go tool cover -func=coverage.out |
| JUnit |
mvn jacoco:report |
Compare against test-strategy skill targets:
- Line coverage ≥ 80% (hard minimum 60%)
- Branch coverage ≥ 75% (hard minimum 50%)
- New code coverage ≥ 90%
6. Summary
## Test Results
| Metric | Value |
|--------|-------|
| Total tests | X |
| Passed | X |
| Failed | X |
| Skipped | X |
| Duration | Xs |
| Coverage | X% (target: 80%) |
### Failures Fixed
- [test name] — [what was wrong] — [fix applied]
### Remaining Failures (needs attention)
- [test name] — [error] — [classification]
### Coverage Gaps
- [file/module] — [current%] — [uncovered lines]
**Overall**: ✅ PASS / ❌ FAIL — [action needed]
Integration
- Called by:
feature-dev skill, bugfix skill, pre-commit skill
- Skills:
test-strategy skill
- Roles:
qa-engineer role (test strategy), stack-specific role (implementation)
1---2name: run-tests-23description: Run tests workflow — execute test suite, analyze failures, auto-fix obvious issues, re-run. Follow-up skill for `feature-dev`, `bugfix`, and `pre-commit`. Uses the `test-strategy` skill.4---56# Run Tests78Execute the project's test suite, analyze failures, attempt fixes, and re-run. Designed as a reusable follow-up skill called by `feature-dev` skill, `bugfix` skill, and `pre-commit` skill.910Uses `test-strategy` skill for test writing patterns and coverage targets.1112## 1. Detect Test Stack1314Read `TESTING.md` (if exists) for test commands, infrastructure, and credentials. Fall back to `AGENTS.md` and project config to determine:1516| Signal | Stack | Runner |17|---|---|---|18| `package.json` + vitest/jest | TypeScript/JS | `npx vitest run` / `npx jest` |19| `pom.xml` / `build.gradle` | Java | `mvn test -q` / `gradle test` |20| `pyproject.toml` / `pytest.ini` | Python | `pytest -x -q` |21| `go.mod` | Go | `go test ./...` |22| `*.csproj` | .NET | `dotnet test` |2324## 2. Run Tests2526Execute the test suite:2728```29// turbo30<test-command>31```3233Capture:34- **Exit code**: 0 = all pass, non-zero = failures35- **Output**: Test names, pass/fail counts, error messages, stack traces3637## 3. Analyze Failures3839If tests fail, for each failure:40411. **Read the failing test** — understand what it asserts422. **Read the error message and stack trace** — identify the actual vs expected433. **Classify the failure**:4445| Classification | Action |46|---|---|47| **Code bug** — test is correct, implementation is wrong | Fix the implementation (Step 4) |48| **Test bug** — test is wrong or outdated | Fix the test (Step 4) |49| **Environment issue** — missing dependency, port conflict, DB down | Report to user (Step 5) |50| **Flaky test** — passes on re-run without changes | Flag for investigation |5152## 4. Fix and Re-Run5354For auto-fixable failures:55561. Apply the appropriate stack-specific role (`frontend-engineer` role, `java-engineer` role, `python-engineer` role, etc.)572. Apply the minimal fix — do not refactor unrelated code583. Re-run the failing test(s) specifically:5960| Stack | Run Single Test |61|---|---|62| Vitest | `npx vitest run <test-file>` |63| Jest | `npx jest <test-file>` |64| pytest | `pytest <test-file>::<test-name> -v` |65| JUnit/Maven | `mvn test -pl <module> -Dtest=<TestClass>#<method>` |66| Go | `go test -run <TestName> ./path/...` |67684. If the fix works, re-run the full suite to check for regressions695. **Max 3 fix attempts per failure** — if still failing after 3 tries, escalate to user7071## 5. Coverage Check (if available)7273Run coverage report:7475| Stack | Command |76|---|---|77| Vitest | `npx vitest run --coverage` |78| Jest | `npx jest --coverage` |79| pytest | `pytest --cov=<package> --cov-report=term-missing` |80| Go | `go test -coverprofile=coverage.out ./... && go tool cover -func=coverage.out` |81| JUnit | `mvn jacoco:report` |8283Compare against `test-strategy` skill targets:84- Line coverage ≥ 80% (hard minimum 60%)85- Branch coverage ≥ 75% (hard minimum 50%)86- New code coverage ≥ 90%8788## 6. Summary8990```91## Test Results9293| Metric | Value |94|--------|-------|95| Total tests | X |96| Passed | X |97| Failed | X |98| Skipped | X |99| Duration | Xs |100| Coverage | X% (target: 80%) |101102### Failures Fixed103- [test name] — [what was wrong] — [fix applied]104105### Remaining Failures (needs attention)106- [test name] — [error] — [classification]107108### Coverage Gaps109- [file/module] — [current%] — [uncovered lines]110111**Overall**: ✅ PASS / ❌ FAIL — [action needed]112```113114## Integration115116- **Called by**: `feature-dev` skill, `bugfix` skill, `pre-commit` skill117- **Skills**: `test-strategy` skill118- **Roles**: `qa-engineer` role (test strategy), stack-specific role (implementation)