On 18 November 2010 16:50, Mauro Talevi <[email protected]> wrote:

> Hi Dan,
>
> On 18/11/2010 16:11, Dan Godfrey wrote:
> > Hi,
> >
> > I'm putting some common GivenStories within a sub folder of my story
> > folder, so that they don't get executed on their own. Something like
> this:
> >
> > common/common1.story
> > common/common2.story
> > story1.story
> > story2.story
> >
> > Scenarios in both story1 and story2 have GivenStories:
> > common/common2.story and common2.story has GivenStories: common1.story.
> >
> > However, this is breaking as it's not looking in the common sub-folder
> > for common1.story, but looking in the main folder. Is this correct or
> > do you want me to raise a JIRA issue?
> >
> Not sure I understand the problem.  The paths in the GivenStories are
> not relative but absolute, at least wrt the classloader used in the
> LoadFromClasspath(Class).
>
> If you send sample project reproducing the problem we can have a look.
>

That's the exact problem, the paths are absolute. This means all stories
need to be in the same folder, whereas I was trying to put common stories
(as includes) into a sub folder so they aren't run normally, only as a given
story.

I'll put together a sample at some point, it's not that pressing at the
moment, I'll just live with running the stories multiple times.



> > More generally, is it considered "best practice" to use GivenStories?
> > They're useful but come with some limitations, such as the above and
> > using a GivenStory includes all scenarios from the story, meaning I
> > need a story/scenario in some cases. But they do provide a useful way
> > to store common data to be shared between multiple scenarios.
> You could cherry-pick scenarios in a given story by using meta filters
> at scenario level.
>
> Or you may want to check out the new composite steps in 3.2-beta-1:
>
> http://jbehave.org/reference/preview/composite-steps.html
>
>
Cool, I'll take a look.

Dan.

Reply via email to