Search code examples
javabddjbehave

Does it possible to skip before and after stories for particular test scenrio in JBehave


In JBehave we can have set of functions to be done "beforeStories" and "afterStories". But for some certain scenarios BeforeStories and AfterStories are not needed at all. Are there any way to omit running before stories and after stories for that cases to avoid unneccssary time spend on before and after stories when doing long set of scenarios.

For an example

BeforeStories:
Given purge database
And login to system as Admin

AfterStories:
Logout from the system

Scenario : 01
// scenario related to database and login

Scenario : 02
// scenario related to database only

This is a simple example, but in case if lot of scenario of type 01 and type 02 are exists in a single story and it can't be split into sub stories where "GivenStories" can be used to alter the preconditions. Are there any ways to do so...


Solution

  • No, There is no ways to skip, but as far said by @Bill Hileman, we can use given stories to load up the prerequisites from different files where a single story can be load with help of multiple files