Details

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

      Description

      Antony and other Fitnesse / Concordion users would like something along these lines:

      Given a user Fred Bloggs with username fbloggs and password Pa55word
      When fbloggs logs in with password Pa55word
      Then the page should say "Welcome, Fred Bloggs!"

      Other examples include:

      name | username | password | attempted | message
      --------------------------------------------------------------------------------------------------
      Jane Brown | jbrown | F*bble | F*bble | Welcome, Jane Brown
      Terri Smith | tsmith | W*bble | w*bble | Incorrect username or password
      Terri Smith | tsmith | W*bble | W*bble | Welcome, Terri Smith
      Fred Bloggs | fbloggs | Pa55word | Password | Incorrect username or password

      where the table headings are the same as the parameters in the various steps.

      Reckon this could be done, either by using paranamer or by catching the parameter names in the steps (which we don't do at the moment). Shouldn't be too hard. Will look at it over the weekend.

        Activity

        Hide
        Mauro Talevi added a comment -

        Perhaps we could have table parser, referenced to by annotation, whereby each row of table represents a re-run of the same scenario with different parameters.

        Show
        Mauro Talevi added a comment - Perhaps we could have table parser, referenced to by annotation, whereby each row of table represents a re-run of the same scenario with different parameters.
        Mauro Talevi made changes -
        Field Original Value New Value
        Fix Version/s 2.2 [ 14670 ]
        Fix Version/s 2.1 [ 14547 ]
        Component/s Core [ 11086 ]
        Mauro Talevi made changes -
        Affects Version/s 2.0 [ 14456 ]
        Hide
        Mauro Talevi added a comment -

        Bumping out of 2.2 release until consensus is reached on how to approach problem.

        Show
        Mauro Talevi added a comment - Bumping out of 2.2 release until consensus is reached on how to approach problem.
        Mauro Talevi made changes -
        Fix Version/s 2.2 [ 14670 ]
        Fix Version/s 2.3 [ 14941 ]
        Mauro Talevi made changes -
        Assignee Elizabeth Keogh [ sirenian ] Mauro Talevi [ maurotalevi ]
        Hide
        Mauro Talevi added a comment -

        After pairing at Agile2009 with Paul, we introduced a new optional table section in the scenario which includes all the replaceable values of a scenario template. E.g.:

        Given some stocks of <prices> and a <threshold>
        When one of these stocks is traded at <price>
        Then the trader is alerted with <status>

        Examples:

        prices threshold price status
        0.5,1.0 15.0 5.0 OFF
        0.5,1.0 15.0 11.0 OFF
        0.5,1.0 15.0 16.0 ON

        The presence of the Examples: keyword (which must be found after the steps at the end of the parseable portion of each scenario) triggers the execution of the scenario for as many times as the number of table data lines (i.e. excluding the first header line).

        Note that the presence of <> is purely conventional, as it signals to the scenario writer that the parameter value will be picked up from the table. The parameters are injected via @Named annotations, e.g.:

        @Given("some stocks of <prices> and a <threshold>")
        public void pricesWithThreshold(@Named("prices") List<Double> prices, @Named("threshold") double threshold)

        { // ... }

        and it's the value of the @Named annotation that is used to read the value from the table.

        Next step, is to have a similar mechanism at play using paranamer instead of annotations, so to offer developers the choice between the annotation-based and convention-based approaches.

        Show
        Mauro Talevi added a comment - After pairing at Agile2009 with Paul, we introduced a new optional table section in the scenario which includes all the replaceable values of a scenario template. E.g.: Given some stocks of <prices> and a <threshold> When one of these stocks is traded at <price> Then the trader is alerted with <status> Examples: prices threshold price status 0.5,1.0 15.0 5.0 OFF 0.5,1.0 15.0 11.0 OFF 0.5,1.0 15.0 16.0 ON The presence of the Examples: keyword (which must be found after the steps at the end of the parseable portion of each scenario) triggers the execution of the scenario for as many times as the number of table data lines (i.e. excluding the first header line). Note that the presence of <> is purely conventional, as it signals to the scenario writer that the parameter value will be picked up from the table. The parameters are injected via @Named annotations, e.g.: @Given("some stocks of <prices> and a <threshold>") public void pricesWithThreshold(@Named("prices") List<Double> prices, @Named("threshold") double threshold) { // ... } and it's the value of the @Named annotation that is used to read the value from the table. Next step, is to have a similar mechanism at play using paranamer instead of annotations, so to offer developers the choice between the annotation-based and convention-based approaches.
        Mauro Talevi made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Mauro Talevi added a comment -

        Renamed feature to reflect the fact that all scenario execution are driven by the examples table, rather than only "other" examples.

        Show
        Mauro Talevi added a comment - Renamed feature to reflect the fact that all scenario execution are driven by the examples table, rather than only "other" examples.
        Mauro Talevi made changes -
        Summary Other examples include Table examples include
        Mauro Talevi made changes -
        Resolution Fixed [ 1 ]
        Status In Progress [ 3 ] Closed [ 6 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved: