gwen-interpreter / gwen

Core Gwen interpreter
https://gweninterpreter.org
Apache License 2.0
36 stars 8 forks source link

Scenario Outlines #29

Closed bjuric closed 7 years ago

bjuric commented 7 years ago

This PR adds support for scenario outlines. A number of people have asked about this capability, so we thought we'd implement it.

Each Example record in a ScenarioOutline is expanded during normalisation and evaluated as aScenario during execution. Scenario outlines are evaluated inline where declared but can also be annotated as @StepDefs if deferred execution is required (this makes them callable from anywhere and executable in the REPL also).

You can download the following SNAPSHOT to have a play

Sample Use

 Feature: Join Strings

   Scenario Outline: Joining <string 1> and <string 2> should yield <result>

     This scenario is evaluated at the point where the outline is declared.
     Joining <string 1> and <string 2> should yield <result>

     Given string 1 is "<string 1>"
       And string 2 is "<string 2>"
      When I join the two strings
      Then the result should be "<result>"

     Examples: Basic string concatenation

       The header row contains the placeholder names. The body rows that
       follow contain the data that is bound to each scenario that is evaluated.

       | string 1 | string 2 | result   |
       | howdy    | doo      | howdydoo |
       | any      | thing    | anything |

   Scenario: Verify that we can join two strings together
       Given I join two strings together

Meta file:

 Feature: Join Strings Meta

  @StepDef
  Scenario: I join the two strings
     Given the result is "${string 1}${string 2}"

Report:

screen shot 2017-03-13 at 9 48 27 am

Each example record in the report is a hyperlink that when clicked opens up the linked scenario.

screen shot 2017-03-13 at 9 54 43 am