cucumber-attic / cucumber-ruby-tcl

Tcl bindings for Cucumber
MIT License
9 stars 6 forks source link

Avoid starting a new TCL interpreter for each scenario #38

Closed ahhbristow closed 7 years ago

ahhbristow commented 7 years ago

I've added support to pass in an environment variable called NEW_INTERPRETER when running Cucumber TCL. This changes Cucumber TCL to not start a new TCL interpreter for each scenario, which drastically improves the speed of our tests by not having to source env.tcl each time (which may do a lot of initialisation work). By passing NEW_INTERPRETER=1 into the Cucumber command, you can force a new interpreter.

This may be useful if you believe there is data leakage between scenarios due to TCL packages loaded as part of the test run retaining global or namespace variables, which could be a problem for poorly understood legacy code.

NEW_INTERPRETER defaults to 0.

ahhbristow commented 7 years ago

I branched off from v0.0.6 rather than HEAD (which is unreleased and untested at the min), hence the conflict.

aslakhellesoy commented 7 years ago

Could you document this in the README please?

Would it be possible to add a test for this as well?

Thanks!

Aslak

ahhbristow commented 7 years ago

Will do, I'm not sure how the tests work yet as this is my first submission and haven't run them :). Just wanted to get this on a branch to see if I've taken the correct approach.

mattwynne commented 7 years ago

@ahhbristow check https://github.com/cucumber/cucumber-ruby-tcl/blob/master/CONTRIBUTING.md for how to run the tests.

mattwynne commented 7 years ago

Looks like a reasonable approach to me.

mattwynne commented 7 years ago

It will be a good challenge to see if you can express this in a feature file.

ahhbristow commented 7 years ago

Thanks @mattwynne, it took me a while to figure out how everything fits together but I've updated reset_state.feature with some new scenarios now. I've also fixed a bug related to file sourcing where only one step definition file was being loaded regardless of how many there were, and updated one of the scenarios to capture this.

Updated the README.md as well.

ahhbristow commented 7 years ago

@mattwynne I've incorporated your suggestions, and added myself as a release manager in CONTRIBUTING.md. I'll get Jowers to grant release privilege so I can put a new version out. Thanks for reviewing my changes.

mattwynne commented 7 years ago

👍

Typed with my Thumbs.

On 19 Apr 2017, at 01:50, Shaun Bristow notifications@github.com wrote:

@mattwynne I've incorporated your suggestions, and added myself as a release manager in CONTRIBUTING.md. I'll get Jowers to grant release privilege so I can put a new version out. Thanks for reviewing my changes.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

--

The Cucumber logo is the intellectual property of Cucumber Ltd, a limited company registered in Scotland, number 456793.

UK Headquarters: Cucumber Ltd, Drumsyniebeg, Lochgoilhead, Cairndow, Argyll, PA24 8AN UK.

CONFIDENTIALITY NOTICE: The information in this e-mail is confidential and privileged; it is intended for use solely by the individual or entity named as the recipient hereof. Disclosure, copying, distribution, or use of the contents of this e-mail by persons other than the intended recipient is strictly prohibited and may violate applicable laws. If you have received this e-mail in error, please delete the original message and notify us by email immediately. Thank you. Cucumber Ltd.