Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

cucumber-scala instantiates step definition classes per test JVM instead of per scenario #1

Closed
mpkorstanje opened this issue Oct 14, 2017 · 2 comments · Fixed by #30
Assignees
Labels
🐛 bug Defect / Bug ⚡ enhancement Request for new functionality
Milestone

Comments

@mpkorstanje
Copy link
Contributor

From: cucumber/cucumber-jvm#755

From https://groups.google.com/forum/#!topic/cukes/eOhisAzEvQo, written by @tristanmccarthy:

"The problem I am hitting is that step def classes appear to be instantiated only once, at the start of the test run. Based on reading around (and previous experience with Java) I'd expect the glue code classes to be instantiated once per scenario instead, and the way I am trying to set everything up requires this."

"...I've stuck a quick and dirty example up on github for some context:
https://github.com/tristanmccarthy/cucumber-scala-webtest"

@RichardBradley
Copy link

Related to #4

@gaeljw
Copy link
Member

gaeljw commented Apr 14, 2020

We workaround this by using traits but 100% agree we should not need traits.

By default, each scenario should have its own context, with new instance classes.

@gaeljw gaeljw mentioned this issue Apr 19, 2020
mpkorstanje pushed a commit that referenced this issue Apr 20, 2020
This PR aims to upgrade Cucumber dependency to 5.X, actually 5.6.0.

**Content:**
- update code to be compatible with Cucumber 5.6.0
- added some tests (mainly copied from Cucumber Java)
- add documentation in README about major changes:
  - move all classes under `io.cucumber.scala` to be more consistent with Cucumber Java
  - parameters change in Before/After hooks to be consistent with Cucumber Java
- upgrade Scala versions, Scala Maven plugin and Groovy

The breaking changes are open to discussion but I feel:
- it helps convey the idea that there is major changes with the upcoming 5.x release (I would like to include the fix for #1 as well, PR coming soon...)
- it makes Cucumber Scala more consistent with Cucumber Java and will ease developers to contribute
@gaeljw gaeljw self-assigned this Apr 25, 2020
@gaeljw gaeljw added 🐛 bug Defect / Bug ⚡ enhancement Request for new functionality labels Apr 25, 2020
@gaeljw gaeljw added this to the 5.6.0 milestone Apr 25, 2020
@gaeljw gaeljw closed this as completed in #30 May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Defect / Bug ⚡ enhancement Request for new functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants