small medium large xlarge

Generic-user-small
14 Sep 2014, 15:49
Simon Billingsley (2 posts)

Hello, I have just finished reading the section about Guice. I can see from the cucumber codebase on github, that Guice now supports a new scope: @ScenarioScoped. https://github.com/cucumber/cucumber-jvm/tree/master/guice/src/main/java/cucumber/runtime/java/guice (Change was from April 2014)

The chapter about Guice does not mention @ScenarioScoped as an option for injecting stepdefs / objects using scenario scope. I was under the impression that PicoContainer always used scenario scope, where a new instance of an object is created for each scenario. And using @ScenarioScoped as the scope would reproduce this behaviour instead of using @Singleton scope.

I was under the impression that @Singleton scope would allow object instances to be shared by all scenarios in a feature and all features that are part of the test run - which is what I need and the reason why I am considering switching from PicoContainer to Guice. Can you please clarify this behaviour for me and add to the chapter to include this information as I think it would be very helpful. Thanks, Simon.

Generic-user-small
30 Sep 2014, 09:53
Seb Rose (19 posts)

Thanks for those comments

You must be logged in to comment