Hi Mauro *>> As I understand it, you'd like the GivenStories to be considered as part of the parametrised scenario context and be passed the row of parameters that is being processed as part of a parametrised scenario. I guess, we could make that the default behaviour, and any parameters passed to the given stories could be overridden by the execution of the given story. * Yes:- That would be absolutely perfect and I think it would be a sensible default
Cheers Dave On 19 January 2012 17:23, Mauro Talevi <[email protected]> wrote: > Hi Dave, > > the use case of using the GivenStories and parametrised scenarios together > has not been considered yet. > > The examples table content is "known" to the given stories, but in order > to pass them to the scenario context we need to come up with some > convention (via some sort of anchor) and be clear of what the convention > means in terms of behaviour. > > As I understand it, you'd like the GivenStories to be considered as part > of the parametrised scenario context and be passed the row of parameters > that is being processed as part of a parametrised scenario. I guess, we > could make that the default behaviour, and any parameters passed to the > given stories could be overridden by the execution of the given story. > > Cheers > > > On 19/01/2012 13:24, Dave Carey wrote: > > JBehave provides a nice feature for parameterizing scenarios to allow > repeating tests. As shown in the documentation:- > > Given a stock of <symbol> and a <threshold> > When the stock is traded at <price> > Then the alert status should be <status> > > Examples: > |symbol|threshold|price|status| > |STK1|10.0|5.0|OFF| > |STK1|10.0|11.0|ON > > > I was hoping to trying to extend its use in combination with a Given > Story. > > To demonstrate by means of extending the documentation example:- > > I want to extend it to support a GivenStory that selects the current > StockExchange > Now the first example would be 'Nasdaq' and the second 'FTSE'. > > The hypothetical configuration might then be:- > > GivenStories: acme/givenstories/SelectAStockExchange.story > Given a stock of <symbol> and a <threshold> > When the stock is traded at <price> > Then the alert status should be <status> > > Examples: > |stockExchange|symbol|threshold|price|status| > |NASDAQ|STK1|10.0|5.0|OFF| > |FTSE|STK1|10.0|11.0|ON > > When trying this I found that the 'GivenStory' did not inherit the > parameterized variables. > The alternate was to use the anchor tag > > e.g. > GivenStories: acme/givenstories/SelectAStockExchange.story{0} > > but now the example parameters are not available to my parent story AND > I can only pass in one row to the given Story rather than repeating the > test. > > The documentation does make clear that this is a known restriction - > but I thought I'd post to this forum to see if there is any recommendation > on how achieve the desired behaviour? > > thanks > Dave > > >
