serenity-bdd / serenity-cucumber

Cucumber integration for the Serenity BDD Reporting library
Other
78 stars 74 forks source link

Session state between scenarios #125

Closed ghost closed 6 years ago

ghost commented 6 years ago

There is much discussion around sharing session state between step classes either by use of session variables or nested steps, both of which I have implemented successfully. However, I need to achieve scenario isolation - i.e. the session state should be refreshed for each scenario. I do not wish to do this manually using @Before as I'm concerned there will be implications when running parallel if it is the same session data being shared across the scenarios.

To simplify matters even further I compared this with how I would expect Serenity session variables to behave - I would have expected them to be refreshed between scenarios as good test practice is to create independent tests. I looked at the Serenity.maintain.session=false system property, but it's false by default and seems to have no effect. I have tried a multitude of versions, but the latest versions also exhibit this behaviour: serenity-core - 1.8.21 serenity-junit - 1.8.21 serenity-cucumber - 1.6.10 serenity-spring - 1.8.21 spring-context - 5.0.3.RELEASE spring-test - 5.0.3.RELEASE

wakaleo commented 6 years ago

This will be fixed in serenity-core 1.9.0 (and in 1.9.0-rc.5)