Hi Marc,

firstly, thanks for your feedback. It's very nice to hear that you find the tool useful and productive.

To your query, I'm not really sure I totally understand the use case you're presenting.

The Examples allow the parametrisation of a scenario, but where not really thought of for the purpose you describe as pre-conditions, i.e. you can expect the "calling scenario" to be able to cherry-pick the parameter sets in the given story.

If you want to pick and choose parameter rows for a given story, you can use parameterised GivenStories

http://jbehave.org/reference/stable/given-stories.html

|Scenario||: A scenario in which the user can run other stories as pre-requisites|
|||parametrized using the rows of the ||Examples| |table|
|GivenStories||: path/to/precondition.story#{0},|
|||path/to/precondition.story#{1}|
|Given| |... // normal scenario steps|
|Examples||:|
||One|Two||
||uno|due||
||un|deux||


The crucial difference being that the parameter sets are specified in the calling scenario, not in the given story.

Hope that helps.

Cheers

On 30/09/2011 14:26, Marc Jambert wrote:
Sorry there is a mistake in my previous mail!
Here is the fixed version, forget about the previous one ...



Hello!

First of all, many thanks to JBehave developers for their work, I have
been using JBehave for 1 month and have been very enthusiastic about it
so far. Moreover it is both clearly documented and clearly coded!

The problem I recently encountered is when combining Examples and
GivenStories. Here are my two sample stories :

------------------------------------------------------------------------------
Story: test story 1
Scenario: test scenario 1

Given<something>  I need to do to prepare this first story environment
When some<firstEvent>  occurs
Then I can check a<firstOutcome>

Examples:
|something |firstEvent |firstOutcome |
|something1|firstEvent1|firstOutcome1|
|something2|firstEvent2|firstOutcome2|

------------------------------------------------------------------------------
Story: test story 2
Scenario: test scenario 2

GivenStories: org/ow2/petals/jbehave/spike/testStory1.story
When a<secondEvent>  occurs
Then I can check a<secondOutcome>

Examples:
|something |firstEvent |firstOutcome |secondEvent |secondOutcome |
|something3|firstEvent3|firstOutcome3|secondEvent3|secondOutcome3|
|something4|firstEvent4|firstOutcome4|secondEvent4|secondOutcome4|

------------------------------------------------------------------------------

I want to be able to execute my 2 stories independently ie :
   - when I run test story 1, it scenario 1 is run with examples included
in story 1
   - when I run test story 2, both story 1 and story 2 are run with
examples included in story **2**<= this was the error. Otherly said,
what I want is "For an
execution of scenario 2 with example at ROW, I want as a scenario 1 of
story 1 to be run as a prerequisite with the *same* example ROW.

I cannot manage to obtain this behaviour...

After trying several configs of GivenStories, here is what I get :
***
GivenStories: org/ow2/petals/jbehave/spike/testStory1.story =>
all examples of story 1 are run as a prerequisite of story 2 =>  KO
***
GivenStories: org/ow2/petals/jbehave/spike/testStory1.story#{0},
               org/ow2/petals/jbehave/spike/testStory1.story#{1} =>
all examples of story 1 are run as a prerequisite of story 2 =>  KO


Have I misunderstood some concept, or misused something ?
What would be the best way to implement this with JBehave, keeping in
mind that I would like to avoid copying and pasting steps across
stories.

Thanks

Marc














---------------------------------------------------------------------
To unsubscribe from this list, please visit:

     http://xircles.codehaus.org/manage_email



Reply via email to