Pergunta

I writing stroy scenarios for JBehave auto-tests. Here required to write several similar scenarios, differs from each-other by constants parameters.

To not copy a lot of scripts i wish to add parameters to my story and call it multiple times with different arguments.

How can i do this using "GivenStories"?

Here i found tutuorials about how to do this http://jbehave.org/reference/preview/given-stories.html, but there are lack of examples of how does it work. I tried to do this in this way:

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|

But strings "One" and "Two" was not replaced by strings form Examples table. Maybe i should declare my arguments in given story? Anyway i want to know how i can inject parameters into my stories and will try every proposed method.

Thank you.

Foi útil?

Solução 2

I found my error. I was trying to put variable names in table with brackets

Outras dicas

Every feature of JBehave has one correspondent example in source code. take a look on those: GivenStoriesParametrisedByMeta GivenStoriesParametrisedByExamples GivenStoriesParametrisedByMeta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top