testing-essentials

Installation
SKILL.md

Testing Essentials

RULES — Follow these with no exceptions

  1. Follow the project's existing test setup patterns (e.g. shared setup helpers like setup :store_test_session) — don't inline DataCase/ConnCase boilerplate that the project already abstracts away
  2. Test both happy path AND error/invalid cases for every function
  3. Use async: true only when safe — safe: pure functions, changesets, helpers; unsafe: DB contexts with shared rows, LiveView, Application.put_env, external services
  4. Define test data in fixtures (test/support/) — never build it inline across multiple tests
  5. Use has_element?/2 and element/2 for LiveView assertions — not html =~ "text" for structure checks
  6. Always test the unauthorized case for any protected resource
  7. Test the public context interface, not internal implementation details
  8. Use describe blocks to group tests by function or behavior

TDD Workflow

Write the failing test first. Run it to confirm it fails for the right reason. Implement the minimum code to make it pass. Never write implementation before the test exists.

Related skills
Installs
1
GitHub Stars
118
First Seen
Apr 21, 2026