In JBehave, BeforeStory or AfterStory annotation can be added in Step level. So if there are multiple Steps classes with BeforeStory annotation, all those BeforeStory annotated methods will be executed before the each and every story start (which is not needed).
In JUnit we can add or leave BeforeClass or Before as needed in test classes separately. So what I need is a way to add BeforeStory or AfterStory in a story level just like JUnit test class.
Is there a way to add BeforeStory as a lifecycle in a story file ? or any alternative solution ?
Following example shows only adding Before in the lifecycle.
http://jbehave.org/reference/stable/story-syntax.html
Lifecycle:
Before:
Given a step that is executed before each scenario
After:
Outcome: ANY
Given a step that is executed after each scenario regardless of outcome
Outcome: SUCCESS
Given a step that is executed after each successful scenario
Outcome: FAILURE
Given a step that is executed after each failed scenario
Thanks.