Search code examples
javajbehave

How to run jbehave scenario multiple times sequentially


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?


Solution

  • 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