A data generation framework for Elixir that simplifies creating test records as maps or Ecto models.
Blacksmith is a data generation framework for Elixir that simplifies creating test records, such as maps or Ecto models, with customizable attributes and sequences. It solves the problem of repetitive and brittle test data setup by providing a declarative way to define and generate realistic data. The framework integrates seamlessly with Elixir's ecosystem, including Ecto for database persistence.
Elixir developers who write tests and need to generate consistent, reusable test data for applications, especially those using Ecto for database interactions.
Developers choose Blacksmith for its simplicity, flexibility, and tight integration with Elixir's testing workflow, reducing boilerplate and improving test maintainability compared to manual data creation.
Data generation framework for Elixir
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Directly works with Ecto models and repositories, as shown in the README where it delegates to Ecto's insert functions for saved records, streamlining database-backed test data.
Supports reusable model templates with default values, sequences, and Faker integration, allowing consistent and customizable test data generation without boilerplate.
Enables creating lists of records with single calls and using having blocks to share attributes across multiple records, improving test setup efficiency and maintainability.
Configurable save functions let developers integrate with any persistence system beyond Ecto, providing flexibility for specialized testing scenarios.
Requires setting up Blacksmith.Config and Forge modules with specific attributes and functions, which can be verbose compared to simpler, inline data generation methods.
The README admits nesting of having blocks is planned for the next release, indicating current restrictions in handling complex, hierarchical contextual data.
Relies on the Faker library for fake data, adding an extra dependency that might cause compatibility issues or bloat in projects not already using it.