O'Reilly logo

Quality Code: Software Testing Principles, Practices, and Patterns by Stephen Vance

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Factories

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required