testinglisted
Install: claude install-skill andr-ca/agentharness
# Testing
This skill is self-contained for day-to-day use. Deeper reference (needs
the full harness checkout): `patterns/testing/TDD.md` (full TDD
workflow), `patterns/testing/COVERAGE_REQUIREMENTS.md` (80% rule and
pragma), `patterns/testing/PLAYWRIGHT_UI_TESTING.md` (E2E screenshots),
`patterns/testing/COMPLETION_CHECKLIST.md`.
## Rigor tiers — apply the right standard, not the maximum
| Tier | Coverage | TDD | Notes |
|---|---|---|---|
| **Production** | **≥ 80%** line+branch | Required | Libraries, agents, shipped services |
| **Internal** | Must have tests | Recommended | No numeric floor; cover what's expensive to get wrong |
| **Prototype** | None required | Optional | Skip freely; document the decision |
Check `.agentharness-profile` or `.github/CODING_GUIDELINES.md` for the
project's tier before assuming 80% applies.
## Red-Green-Refactor
1. **Red** — write a failing test for the *one* behavior you're adding.
2. **Green** — write the minimum code to make it pass (not the final
code — the correct code comes in the next step).
3. **Refactor** — clean up duplication and naming while tests stay green.
Never skip Red — a test that never fails doesn't prove anything.
## Test one behavior per test
```python
# WRONG: five assertions for one behavior — one failure hides the rest
def test_user_creation():
user = User.create(email="a@b.com", password="s3cr3t")
assert user.id is not None
assert user.email == "a@b.com"
assert user.password_hash is not