A fixture library for Elixir applications using Ecto, providing structured test data with associations and inheritance.
EctoFixtures is a library for managing test fixtures in Elixir applications that use Ecto for database interactions. It provides a clean, declarative DSL to define reusable test data, automatically handles associations, and offers flexible control over database insertion during testing.
Elixir developers building applications with Ecto who need structured, maintainable test data for ExUnit-based testing, particularly those dealing with complex database relationships.
Developers choose EctoFixtures for its automatic handling of associations and foreign key constraints, inheritance support for default values, and the ability to override fixture data per test without modifying definitions, streamlining test setup.
Fixtures for Elixir apps
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Provides a readable Elixir DSL for defining fixtures with models and repos, as shown in the accounts.exs example, making test data declarative and maintainable.
Handles belongs_to, has_one, and has_many associations, automatically ordering inserts to avoid foreign key constraints, simplifying complex relationship setups.
Allows overriding column data per test with a map, enabling customization without modifying original fixture definitions, as demonstrated in the overrides example.
Supports inheriting default values between rows and across files, with virtual rows for non-inserted templates, enhancing reusability and reducing duplication.
Overrides cannot add new rows, only mutate existing column data, which restricts dynamic test data creation and limits flexibility in complex test scenarios.
Requires maintaining separate fixture files (e.g., in test/fixtures/), which can be cumbersome for projects with simple or rapidly evolving test data needs.
Tightly coupled with Ecto, making it unsuitable for Elixir applications using other database libraries or ORMs, limiting its broader applicability.