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

Conversation

RichardBradley
Copy link
Contributor

See http://stackoverflow.com/a/33063300/8261 -- it is not at all obvious that Step classes (or their dependencies) are destroyed and re-created for each Scenario. This doc should hopefully make that clearer.

Since the Steps are destroyed & recreated for each Scenario, it is very important to clean up any resources allocated by them (e.g. database connections) otherwise projects with lots of Scenarios will grind to a halt with resource leaks. However, the Picocontainer lifecycle annotations for this are ignored by cucumber-jvm since it sets NullLifecycleStrategy. I have added documentation here about the simplest workaround (@after annotations, which do work).

HTH

@dkowis
Copy link
Member

dkowis commented May 22, 2016

Merged, as of c0ffacd

@dkowis dkowis closed this May 22, 2016
@RichardBradley
Copy link
Contributor Author

@dkowis, as per my comments on #994, the commit c0ffacd is not contained in any public branch of cucumber-jvm, so this hasn't actually been merged yet.

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants