6

There is a JBehave scenario. For example, Given something some record in DB (inserts some record in DB) When service perform some action (call some service)

Is there any way to run this scenario many times in single story run?

long
  • 414
  • 4
  • 15
  • 1
    The easiest way is to append an `Examples:` table at the end of the scenario, and fill it with 100 rows if you want to repeat the scenario 100 times. See this link: http://jbehave.org/reference/stable/tabular-parameters.html – krokodilko Dec 13 '14 at 09:43
  • 1
    Unfortunately, this approach is not appropriate. Several steps already have long parameter tables. Moreover, I need to repeat scenario for about 100k times, so copy-paste approach doesn't fit :) – long Dec 14 '14 at 10:21

1 Answers1

7

Another approach:

Run jbehave scenario multiple times sequentially

Narrative:
In order to run jbehave scenario multiple times sequentially
As a development team
I want to use examples table

Scenario:  run jbehave scenario multiple times sequentially
GivenStories: path/to/story/we/want/to/run/multiple/times/storyname.story

Then some null step

Examples:
|x|
|1|
|2|
...
...
...
|100000|

If you dont want to copy/paste lines of the examples table in the story, then load the table from a file:

 Examples:
 /path/to/file/with/parameters/somefile.table

See: Loading parameters from an external resource for details

krokodilko
  • 35,300
  • 7
  • 55
  • 79
  • 1
    Your approach is not very elegant, but it's better than nothing. Thank you. Hope we would have this http://jira.codehaus.org/browse/JBEHAVE-873 implemented some day. – long Dec 15 '14 at 13:32