layout | title |
---|---|
bootstrap |
Dependency Injection |
This is only relevant if you are using Cucumber-JVM with Java.
Java Step Definitions are annotated methods that live in a class:
{% highlight java %} public class BellyStepdefs { @Given("I have (\d+) cukes in my belly") public void cukesInTheBelly(int cukes) { // Do something with the cukes } } {% endhighlight %}
For each scenario, Cucumber will instantiate all classes that have glue code (Step Definitions or Hooks).
- Describe why inheritance is bad
- DI allows glue classes to share references to the same instances
- Describe the different containers
- Check the mailing list for common Q&A