| name | test-runner |
| description | Execute tests, analyze results, and diagnose failures across any testing framework. Use when running test suites, debugging failing tests, or configuring CI/CD testing pipelines. |
| version | 1.0 |
| template_version | 0.2 |
| license | MIT |
Test Runner
Expert skill for test execution and failure diagnosis.
Quick Start
Test Checklist:
- [ ] Environment configured
- [ ] Tests run or failures captured
- [ ] Failed tests diagnosed
- [ ] Coverage report generated
When to Use
- Running test suites
- Debugging failing tests
- Setting up CI/CD pipelines
- Analyzing test coverage
- Identifying flaky tests
Framework Commands
JavaScript
jest
jest path/to/test.ts
jest --coverage
jest --watch
Python
pytest
pytest tests/test.py
pytest --cov=src
pytest -v
Rust
cargo test
cargo test test_name
cargo test -- --nocapture
Go
go test ./...
go test -v ./...
go test -cover ./...
Bash
bats tests/
bats tests/file.bats
Diagnosing Failures
Step 1: Identify Error Type
| Pattern | Likely Cause | Action |
|---|
AssertionError: expected X got Y | Logic error | Check implementation |
TimeoutError | Async issue | Check async/await |
ModuleNotFoundError | Missing dep | Install dependency |
panic: runtime error | Go panic | Check nil/bounds |
Step 2: Isolate Test
pytest test.py::test_func -v
jest --testNamePattern="test"
cargo test test_name
Step 3: Check Environment
pip list | grep pytest
npm list jest
./scripts/setup-test-db.sh
Coverage Analysis
Generate Reports
jest --coverage --coverageReporters=text-summary
pytest --cov=src --cov-report=html
cargo tarpaulin --out Html
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
Coverage Targets
| Type | Minimum | Target |
|---|
| New project | 70% | 85% |
| Legacy | 50% | 70% |
| Critical path | 90% | 95% |
Flaky Test Detection
for i in {1..10}; do pytest || echo "Failed run $i"; done
Best Practices
DO:
- Run tests locally before commit
- Write edge case tests
- Mock external dependencies
- Keep tests fast (<100ms)
- Clean up test state
- Use descriptive names
DON'T:
- Skip tests without TODO
- Hardcode timeouts
- Test implementation details
- Share mutable state
- Ignore flaky tests
- Use sleep without reason
Quality Criteria
References
agents-docs/AVAILABLE_SKILLS.md - Skill framework guide