0
@RunWith(CucumberWithSerenity.class)
@CucumberOptions(<configuration>) 
public Class TestRunner{}

public Class StepDefinitions{}

public Class SomeClass{}

Is there a way to pass object of type SomeClass from TestRunner to StepDefintions? The reason behind this requirement is to have a single object of someClass object for all scenarios.

venkat g
  • 421
  • 1
  • 6
  • 20

1 Answers1

0

The way to share information between steps in different step classes in Cucumber-JVM is to use dependency injection.

Cucumber has bindings to many different dependency injection frameworks. One of them is PicoContainer. I wrote a blog post a while back describing how it can be used.

Thomas Sundberg
  • 4,098
  • 3
  • 18
  • 25