Dependency Injection
Dependency injection (DI) is a technique that allows us to isolate a class from its concrete dependencies until runtime.[34] Often this is used to defer the decision about which actual implementation of an interface we’re going to use. On this occasion, however, Cucumber uses a dependency injection framework to create a single instance of a class and share that instance between all the step definition classes that need to use it. (We’ll talk about Cucumber’s use of DI much more in Chapter 11, Simplifying Design with Dependency Injection .)
Cucumber ships with integrations to several popular DI frameworks to choose from. We’ll use PicoContainer[35] which is probably the most lightweight and is also available under the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access