Skip to content

Add notes about Step class lifecycles #992

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions picocontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Step dependencies

The picocontainer will create singleton instances of any Step class dependencies which are constructor parameters and inject them into the Step class instances when constructing them.

# Step scope and lifecycle

All step classes and their dependencies will be recreated fresh for each scenario, even if the scenario in question does not use any steps from that particular class.

If any step classes or dependencies use expensive resources (such as database connections), you should create them lazily on-demand, rather than eagerly, to improve performance.

The pico container created by `cucumber-jvm` uses a `NullLifecycleStrategy` (see http://picocontainer.com/lifecycle.html ) so the Startable or Disposeable interfaces will be ignored. You should use cucumber.api.java.After annotations to do any necessary cleanup.