Tests that matter
Writes tests for what can actually break, instead of chasing a coverage number.
Cuándo se usa
When wrapping up a feature, or right after fixing a bug so it cannot come back.
SKILL.md
# Tests that matter
Coverage measures executed lines, not prevented failures. Write the tests that
would have caught the last bug that slipped through.
## What to test
- **The edges.** Empty, one, many, negative, null, very long text, emoji.
- **The error paths.** The network fails, the file is missing, the response comes
back in another shape.
- **The business rules.** What matters to whoever uses the app, not to whoever
wrote it.
- **Every fixed bug.** Before the fix, a test that fails.
## What not to test
- That the third-party library does what it promises.
- Getters and setters with no logic.
- The internals of a private function: test what is visible from outside, or any
refactor will break your suite for no reason.
## How to write them
A name that states the case, not the function: "returns an empty list when there
are no results". Arrange, act, assert, with a blank line between the three parts.
One assertion per concept. No logic inside the test: if a test needs an if, the
test needs splitting in two.
Before trusting a test, break it on purpose and check that it fails. A test that
always passes is testing nothing.