// the take
ExMachina is a test data factory library for Elixir, built to pair with Ecto but usable without it. It's aimed at Elixir/Phoenix teams who want FactoryBot-style factories instead of hand-rolled fixtures in their test suites.
The build/insert/params_for split is a genuinely useful distinction — you get unsaved structs, inserted records, or plain params depending on what the test needs, without three different APIs to learn. Lazy attribute evaluation (passing `fn -> build(:user) end`) solves the classic shared-fixture bug where sequence-based factories accidentally reuse the same built struct across multiple inserts. The strategy system is a clean extension point — defining a new strategy is a ~10 line module, not a fork of the library.
Pure Ecto coupling for anything beyond the basics: associations, returning values, and multi-tenant prefixes all route through `Ecto.Repo.insert!/2`, so if your persistence layer isn't Ecto you're stuck with bare `build` and lose insert, params_for, and params_with_assocs entirely. No built-in support for unique constraint retries or cleanup/truncation — that's left to Ecto.Sandbox or ecto_sql, so you're assembling a second library just to make tests reliable in CI. It's a mature, slow-moving project (2.8.x after years), which is fine for stability but means don't expect new strategy helpers or parallel-test ergonomics to show up — check open issues before assuming a gap will get filled.
We read the README, the directory tree and a key source file in October 2026. Nobody pays to be listed. How we judge →