A Java library for generating fake objects from templates to simplify unit testing.
Fixture Factory is a Java library that generates fake objects from templates to simplify unit testing. It allows developers to define reusable templates with data rules instead of hardcoding test data, making tests more maintainable and focused on behavior. The library supports random data generation, relationships, custom processors, and template inheritance.
Java developers writing unit tests who need to generate complex test data objects efficiently. It's particularly useful for teams working on applications with rich domain models requiring consistent test fixtures.
Developers choose Fixture Factory because it provides a declarative, template-driven approach to test data generation, reducing boilerplate code and improving test maintainability. Its support for relationships, custom processors, and flexible data rules makes it more powerful than manual object creation or basic mocking.
Generator fake objects from a template
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Allows defining reusable templates with inheritance and overrides, as shown in the Address template inheriting from 'valid', promoting maintainability and reducing boilerplate.
Supports random values, regex patterns, dates, and unique random selections, enabling controlled yet varied test data generation, evidenced by examples for regex and date functions.
Handles one-to-one and one-to-many relationships easily, such as in the Order example with items and payment, simplifying complex object graphs for unit tests.
Provides a mechanism for post-generation logic, including built-in HibernateProcessor for database persistence, enhancing test setup and integration with persistence layers.
Uses anonymous inner classes for rule definitions, which can be cumbersome, less readable, and not aligned with modern Java features like lambdas or fluent builders.
The README is brief and lacks comprehensive examples for advanced use cases, relying on test code for reference, which can hinder onboarding and troubleshooting.
Package scanning for templates via FixtureFactoryLoader can introduce startup time and complexity, especially in large projects with many templates or complex classpaths.