Dependency Injection

If your programming language is Java you will be writing glue code (Step Definitions and Hooks) in plain old Java classes.

Cucumber will create a new instance of each of your glue code classes before each Scenario. If all of your glue code classes have an empty constructor you don’t need anything else. However, most projects will benefit from a Dependency Injection module to organize your code better and to share state between Step Definitions.

The available Dependency Injection modules are:

PicoContainer

Dependency

<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-picocontainer</artifactId>
    <version>1.2.5</version>
    <scope>test</scope>
</dependency>

Sorry no docs yet, but the code is on GitHub.

Spring

Dependency

<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-spring</artifactId>
    <version>1.2.5</version>
    <scope>test</scope>
</dependency>

Sorry no docs yet, but the code is on GitHub.

Guice

Dependency

<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-guice</artifactId>
    <version>1.2.5</version>
    <scope>test</scope>
</dependency>

Sorry no docs yet, but the code is on GitHub.

OpenEJB

Dependency

<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-openejb</artifactId>
    <version>1.2.5</version>
    <scope>test</scope>
</dependency>

Sorry no docs yet, but the code is on GitHub.

Weld

Dependency

<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-weld</artifactId>
    <version>1.2.5</version>
    <scope>test</scope>
</dependency>

Sorry no docs yet, but the code is on GitHub.

Needle

Dependency

<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-needle</artifactId>
    <version>1.2.5</version>
    <scope>test</scope>
</dependency>

Sorry no docs yet, but the code is on GitHub.