You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This post is based on the archetype "Sample Serenity project using JBehave and WebDriver" (mvn archetype:generate -Dfilter=serenity) example.
I annotated the variable endUser in class DefinitionSteps with @Shared.
public class DefinitionSteps {
@Shared
EndUserSteps endUser;
@Given("the user is on the Wikionary home page")
public void givenTheUserIsOnTheWikionaryHomePage() {
endUser.is_the_home_page();
}
and added a constructor to class EndUserSteps
public class EndUserSteps {
DictionaryPage dictionaryPage;
public EndUserSteps() {
System.out.println("Ups ... I did it again");
}
The example comes with a LookupADefinition.story which contains two scenarios. Usually the constructor of EndUserSteps is to be executed twice. But due to the @Shared annotation I would expect that the constructor would be invoked once only. Is that correct?
Unfortunately, the string "Ups ... I did it again" appears twice in my console output.
I am running the example with <serenity.version>2.3.2</serenity.version> and tried 2.3.8 as well. Furthermore, I did add serenity.maintain.session = true to serenity.properties.
Thanks
The text was updated successfully, but these errors were encountered:
Hi,
This post is based on the archetype "Sample Serenity project using JBehave and WebDriver" (
mvn archetype:generate -Dfilter=serenity
) example.I annotated the variable endUser in class DefinitionSteps with
@Shared
.and added a constructor to class EndUserSteps
The example comes with a LookupADefinition.story which contains two scenarios. Usually the constructor of EndUserSteps is to be executed twice. But due to the
@Shared
annotation I would expect that the constructor would be invoked once only. Is that correct?Unfortunately, the string "Ups ... I did it again" appears twice in my console output.
I am running the example with <serenity.version>2.3.2</serenity.version> and tried 2.3.8 as well. Furthermore, I did add
serenity.maintain.session = true
to serenity.properties.Thanks
The text was updated successfully, but these errors were encountered: