Factories generate entities on demand based on templated or predetermined initialization criteria. We most commonly think of the Gang of Four Abstract Factory [DP] pattern in this role. Other factories exist, including Factory Method and Builder [DP].
Each approach and implementation has distinct characteristics to satisfy its target use case. The key features for consideration in testing are summarized here.
• Singleton-ness: Is the factory a singleton that will, by its nature, be shared between tests?
• Entity initialization flexibility: Does the implementation have sufficient mechanisms to initialize generated entities for the necessary testing variations?
• Registration management: Does the factory allow generated entity types ...