Skip to content

[Spring] Support multithreaded execution of scenarios #1148

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

Merged
merged 1 commit into from
Jun 14, 2017

Conversation

mpkorstanje
Copy link
Contributor

@mpkorstanje mpkorstanje commented Jun 13, 2017

Summary

When running in parallel the dependency injection context was shared between
scenarios. This made it impossible to run cucumber test with spring without
forking the JVM.

To reduce the resources required to execute a test each thread now will
have its own dependency injection context allowing tests to be executed in
parallel threads.

Related issues:

This fixes #1106

How Has This Been Tested?

Created a unit tests that executes the same cucumber scenario in parallel. The scenario knows it is being executed in parallel and checks if it has not been re-used by any other threads.

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist:

  • I've added tests for my code.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

When running in parallel the dependency injection context was shared between
scenarios. This made it impossible to run cucumber test with spring without
forking the JVM.

To reduce the resources required to execute a test each thread now will
have its own dependency injection context allowing tests to be executed in
parallel threads.

Related issues:
 - #1106

 This fixes #1106
@mpkorstanje mpkorstanje merged commit d140a9a into master Jun 14, 2017
@mpkorstanje mpkorstanje deleted the ishmeister-master branch June 14, 2017 23:11
mpkorstanje added a commit that referenced this pull request Jun 18, 2017
 The TestContextManager(Class<?>) uses a static ContextCache. This meant
 that all step definitions from all tests would be registered in same context,
 possibly multiple times.

 This is resolved by creating a ContextCache for each SpringFactory.

 Related issues:
  - https://travis-ci.org/cucumber/cucumber-jvm/jobs/244215644
  - #1148
mpkorstanje added a commit that referenced this pull request Jun 18, 2017
 The TestContextManager(Class<?>) uses a static ContextCache. This meant
 that all step definitions from all tests would be registered in same context,
 possibly multiple times when running in parallel.

 This is resolved by creating a ThreadLocal ContextCache for each
 SpringFactory.

 Related issues:
  - https://travis-ci.org/cucumber/cucumber-jvm/jobs/244215644
  - #1148
mpkorstanje added a commit that referenced this pull request Jun 18, 2017
 The TestContextManager(Class<?>) uses a static ContextCache. This meant
 that step definitions from different threads could be registered in
 same context multiple times when running in parallel.

 This is resolved by creating a ThreadLocal ContextCache for each
 SpringFactory.

 Related issues:
  - https://travis-ci.org/cucumber/cucumber-jvm/jobs/244215644
  - #1148
mpkorstanje added a commit that referenced this pull request Jun 18, 2017
 The TestContextManager(Class<?>) uses a static ContextCache. This meant
 that step definitions from different threads could be registered in
 same context multiple times when running in parallel.

 This is resolved by creating a ThreadLocal ContextCache for each
 SpringFactory.

 Related issues:
  - https://travis-ci.org/cucumber/cucumber-jvm/jobs/244215644
  - #1148
mpkorstanje added a commit that referenced this pull request Jun 18, 2017
 The TestContextManager(Class<?>) uses a static ContextCache. This meant
 that step definitions from different threads could be registered in
 same context multiple times when running in parallel.

 This is resolved by creating a ThreadLocal ContextCache for each
 SpringFactory.

 Related issues:
  - https://travis-ci.org/cucumber/cucumber-jvm/jobs/244215644
  - #1148
mpkorstanje added a commit that referenced this pull request Jun 18, 2017
 The TestContextManager(Class<?>) uses a static ContextCache. This meant
 that step definitions from different threads could be registered in
 same context multiple times when running in parallel.

 This is resolved by creating a ThreadLocal ContextCache for each
 SpringFactory.

 Related issues:
  - https://travis-ci.org/cucumber/cucumber-jvm/jobs/244215644
  - #1148
@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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cucumber spring does not support multi-threaded scenarios
1 participant