Skip to content
This repository has been archived by the owner on May 21, 2019. It is now read-only.

PicoContainer

aslakhellesoy edited this page Sep 13, 2010 · 7 revisions

By default, Cuke4Duke uses PicoContainer to instantiate your Pure java step definitions. Unless your application is based on Spring this is the simplest and fastest way to use Cuke4Duke.

PicoContainer allows your Step definitions to use Constructor Injection to assemble a graph of objects. Example:

package race;
public class Car {}
package race;
public class Driver {
    public Driver(Car car) {}
}
package race;
public class RaceSteps {
    public class RaceSteps(Driver driver, Car car) {}
}

All you need to do in order for Cuke4Duke and PicoContainer to be able to instantiate your RaceSteps is to place the following in your features/support/env.rb file:

require 'cuke4duke/pico_container'

register_class(Java::race.RaceSteps)
register_class(Java::race.Car)
register_class(Java::race.Driver)
Clone this wiki locally