Skip to content

Allow to specify different ObjectFactory classes via annotation #1690

@ralphkar

Description

@ralphkar

Summary

Specifying the ObjectFactory in CucumberOptions would be highly needed.

Description

I have all the relevant Cucumber steps injected by a Guice injector. This injector also needs all of our project specific modules (yes, we are heavily relying on Guice). So far this was ok.
But now I have to support additional features that are only available when configured. Therefore I need to create a differently configured injector for some tests. I have been looking around for a while in order to find out what is the best way to do this in Cucumber.
I found the following (old) post on StackOverflow:
https://stackoverflow.com/questions/35315963/cucumber-with-guice-multiple-guice-injector/40429150#40429150
With this approach it would be possible for me to provide different instances of InjectorSource. Unfortunately the createRuntime()method has been removed from the Cucumber runner.

Possible Solution

Now how could I do this with the current Cucumber (I am using version 4.3.1)? Unless there is another workaround (that I am not aware of), it would be most helpful to allow to specify an ObjectFactory within the CucumberOptions annotation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions