testing-essentials
Installation
SKILL.md
Testing Essentials
Use this skill before writing ANY _test.exs file.
RULES — Follow these with no exceptions
- Follow the project's existing test setup patterns — don't inline DataCase/ConnCase boilerplate that the project already abstracts away
- Test both happy path AND error/invalid cases for every function
- Use
async: trueonly when safe — safe: pure functions, changesets, helpers; unsafe: DB contexts with shared rows, LiveView,Application.put_env, external services - Define test data in fixtures (
test/support/) — never build it inline across multiple tests - Use
has_element?/2andelement/2for LiveView assertions — nothtml =~ "text"for structure checks - Always test the unauthorized case for any protected resource
- Never hardcode dates — use relative timestamps to prevent flaky tests