What We Just Learned
Congratulations, you’re ready to inject dependencies!
In this chapter we’ve seen how Cucumber’s use of dependency injection simplifies the management of the graph of objects needed to run our scenarios. We looked at most of the DI containers that Cucumber is integrated with and saw that PicoContainer is probably the simplest to use, if you aren’t already using one of the others in your project. Most of the other DI containers require some form of annotation and configuration. Once we choose a DI container, no matter which one, it takes over responsibility for creating all our step definition and hook objects.
As we applied DI to our example we pushed more of the responsibilities for creating and initializing our objects ...
Get The Cucumber for Java Book now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.