Using below combination of versions, the parallel execution through surefire is not working properly. If we change Cucumber to 4.8.1, then the parallel execution through surefire works.
**Cucumber 6.10.2 or newer versions, cucumber-Spring, Junit 4.13.2 and Maven surefire 3.0.0.M3 and above **
But once the cucumber version is changed to 6.10.2, it does not work. The specific problem is, the webdriver session is getting leaked among the threads, or in simple word multiple threads acting on the same webdriver session.
I did lot of research and tried multiple configurations in the POM, but it did not work: Trial 1. Excluded junit-jupiter and jupiter-vintage-engine from cucumber-junit, excluded junit-jupiter and jupiter-vintage-engine from cucumber-Spring, Added surefire-junit47 dependency to surefire plugin Trial 2. Added jupiter-vintage-engine as dependency to surefire plugin Trial 3. Using Spring Boot version 2.6.2, Cucumber 6.10.2 or newer versions, cucumber-Spring, Junit 5 and surefire 3.0.0.M7
Will appreciate any help.
Projects typically publish a change log with all relevant changes in it. You should consult it when upgrading major versions.
https://github.com/cucumber/cucumber-jvm/blob/main/CHANGELOG.md
This is a feature of Spring! When using Spring you'll share the same application context between all tests.
You can prevent this by marking the bean with your web driver as scenario scoped.
https://github.com/cucumber/cucumber-jvm/tree/main/cucumber-spring#sharing-state
And if you want to reuse the WebDriver between scenarios on the same thread you can use a Thread local: