Details

    • Type: New Feature New Feature
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.1
    • Component/s: Core
    • Labels:
      None
    • Number of attachments :
      0

      Description

      GivenStories could be parametrised, using the same mechanism of the ExamplesTable and the named parameters.

      If a GivenStory path has an anchor with a number, e.g.

      GivenStories: /path/to/precondition.story#

      {0}

      then the number is assumed to be the row of the ExamplesTable containing the required parameters (if present).

        Activity

        Mauro Talevi made changes -
        Field Original Value New Value
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Cristiano Gavião added a comment -

        How do you think to use it inside the included story ?

        Show
        Cristiano Gavião added a comment - How do you think to use it inside the included story ?
        Hide
        Mauro Talevi added a comment - - edited

        Any sequence of scenarios containing parametrised steps, using exactly the same mechanism in play with the Examples. E.g.

        GivenStories: org/jbehave/examples/trader/stories/parametrised.story#{0}
                      
        When the stock is traded at price 1.1
        Then the alert status is ON
        
        Examples:
        |symbol|threshold|
        |STK1  |1.0|
        

        where the parametrised story might look like:

        Scenario:
        
        Given a stock of <symbol> and a <threshold>
        

        The parameters are picked up from the table row specified in the anchor. So we now have parametrised GivenStories, in addition to the parametrised Scenarios we've always had.

        Note that since the Examples table is used to provide data to the GivenStories, it is not being used to parametrise at the same time the scenario itself (it looks for the presence of anchors in the GivenStories paths). Nothing technically stopping us from using the examples table in parametrising both the GivenStories and the scenario itself, but it'd most probably lead to confusion. We could use the new feature of ExamplesTable (JBEHAVE-371) to pass in some directive, e.g.:

        Examples:
        {scope=Scenario}
        |symbol|threshold|
        |STK1  |1.0|
        

        But that's probably another story ...

        Show
        Mauro Talevi added a comment - - edited Any sequence of scenarios containing parametrised steps, using exactly the same mechanism in play with the Examples. E.g. GivenStories: org/jbehave/examples/trader/stories/parametrised.story#{0} When the stock is traded at price 1.1 Then the alert status is ON Examples: |symbol|threshold| |STK1 |1.0| where the parametrised story might look like: Scenario: Given a stock of <symbol> and a <threshold> The parameters are picked up from the table row specified in the anchor. So we now have parametrised GivenStories, in addition to the parametrised Scenarios we've always had. Note that since the Examples table is used to provide data to the GivenStories, it is not being used to parametrise at the same time the scenario itself (it looks for the presence of anchors in the GivenStories paths). Nothing technically stopping us from using the examples table in parametrising both the GivenStories and the scenario itself, but it'd most probably lead to confusion. We could use the new feature of ExamplesTable ( JBEHAVE-371 ) to pass in some directive, e.g.: Examples: {scope=Scenario} |symbol|threshold| |STK1 |1.0| But that's probably another story ...
        Mauro Talevi made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Mauro Talevi
            Reporter:
            Mauro Talevi
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: