bnadlerjr/dotfiles/testing-elixir

Claude Code and agent skill by bnadlerjr/dotfiles

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Provides expert guidance for writing ExUnit tests in Elixir. Covers core ExUnit patterns, assertions, sociable testing philosophy, Ecto sandbox and database testing, Phoenix controller/LiveView/channel tests, and external API testing with Bypass and Req.Test. Use when working with ExUnit tests, assertions, describe blocks, test organization, Bypass, Req.Test, factories, ExMachina, Ecto sandbox, ConnTest, LiveViewTest, ChannelTest, or test helpers.

Install

npx vskill@latest install bnadlerjr/dotfiles/testing-elixir

SKILL.md

Testing Elixir

Expert guidance for writing great ExUnit tests in Elixir applications.

Quick Start

Testing...Reference FileKey Topics
Core ExUnit setup, tags, asynccore-exunitCase setup, describe, callbacks, tags, async
Assertions and pattern matchingassertionsassert, refute, pattern match, assert_receive
Sociable tests, stubs, behaviourssociable-testingStubs over mocks, behaviours, functional core
Ecto sandbox, factories, DB testsdatabase-testingSandbox, ExMachina, async: true, changesets
Phoenix controllers, LiveView, channelsphoenix-testingConnTest, LiveViewTest, ChannelTest
External HTTP APIs (Bypass, Req.Test)external-api-testingBypass, Req.Test, behaviour stubs
Test architecture, helpers, taggingtest-organizationFile structure, support modules, coverage

Testing Philosophy

These principles are non-negotiable defaults for all ExUnit testing advice.

Sociable Tests by Default

Use real collaborators. A test for Orders.checkout/1 should call real Inventory and Pricing modules, not stubs. Sociable tests catch integration bugs, survive refactors, and test actual behavior.

Stubs Over Mocks

When you must replace a dependency, prefer stubs (modules that return canned data) over mocks (modules that verify call sequences). Use Elixir behaviours to define the contract, then swap implementations via application config or function parameters.

Test Behavior, Not Implementation

Assert on outputs and side effects observable to the caller. Never assert on internal function calls, message ordering between modules, or private state.

Only Stub at True System Boundaries

Real boundaries: external HTTP APIs, payment gateways, email delivery, SMS providers, system clock. Not boundaries: your own context modules, Ecto repos, internal GenServers.

async: true by Default

Every test module should start with async: true unless it requires shared sandbox mode or touches global state. Parallel tests keep the suite fast.

Anti-Patterns

  • Mock-heavy tests: If a test has 3+ mocks, rethink the design. Push side effects to boundaries.
  • Testing private functions: If you need to test a private function, extract it to its own module.
  • Shared mutable state: Tests that depend on order or seed data are fragile. Each test sets up its own data.
  • Asserting implementation details: assert_called MyModule.internal_fn() couples tests to internals.
  • Overly complex factories: Factories with 10+ overrides signal a design problem, not a testing problem.
  • async: false by default: Only disable async when you genuinely need shared sandbox mode.

Reference File IDs

core-exunit . assertions . sociable-testing . database-testing . phoenix-testing . external-api-testing . test-organization

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
5
Repository forks
1
7-day trend score
0

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/bnadlerjr/dotfiles/testing-elixir/badge)](https://verified-skill.com/skills/bnadlerjr/dotfiles/testing-elixir)

Something wrong with this skill or its page? Tell us.