Skip to content

support for scenario descriptions - #79

Merged
jenisys merged 3 commits into
behave:masterfrom
caphrim007:master
Apr 28, 2013
Merged

jenisys merged 3 commits into
behave:masterfrom
caphrim007:master

Conversation

@caphrim007

Copy link
Copy Markdown
Contributor

Hey all,

cucumber supports a description underneath a scenario.

For example

Feature: This is my feature name

In order to be a good steward
As a user of the system
I want to test my scenario

    Scenario: This is my scenario name

        Here is part of my description. Normally you will
        probably just use the name, but it is valid Gherkin to
        follow the name with a multiline description

        Everything up until the first Given, When, or Then will be
        slurped up into the description of the scenario.

        Given that I have a thing
        And the thing is shiny
        Then show the thing to someone

behave version 1.2.2 does not support this though, and raises an exception when it reaches the first line of the scenario description.

For example

Failed to parse "/home/tarupp/features/BehaveTest.feature":
    Parser failure in state steps at line 9

This pull request includes enhancements that will allow behave to read the description (to prevent parser errors) as well as store the description in a description field.

For example

{'background': None,
 'description': [u'Here is part of my description. Normally you will',
                 u'probably just use the name, but it is valid Gherkin to',
                 u'follow the name with a multiline description',
                 u'Everything up until the first Given, When, or Then will be',
                 u'slurped up into the description of the scenario.'],
 'feature': <behave.model.Feature object at 0x1759a50>,
 'filename': '/home/tarupp/features/python/BehaveTest.feature',
 'keyword': u'Scenario',
 'line': 7,
 'name': u'This is my scenario name',
 'steps': [<given "that I have a thing">,
           <given "the thing is shiny">,
           <then "show the thing to someone">],
 'tags': []}

@ghost ghost assigned jenisys Apr 28, 2013
jenisys added a commit that referenced this pull request Apr 28, 2013
CHANGES:

  * Add description attribute also to ScenarioOutline ctor.
  * Move description parameter to end of Scenario/ScenarioOutline ctor.
    => Problem because parameter was already used by steps.
  * Extend JsonFormatter to store Scenario/ScenarioOutline description.
  * Extend json_parser to handle Scenario/ScenarioOutline description.
  * Cleanup/refactor parser to avoid duplicated code fragments:
    => _build_*_statement()
    => subaction_detect_next_scenario() to avoid duplicated code fragments
    => action_next_scenario (tags and more...)
    => Add check that Background does not support tags.
    => ParseError: Add stripped line to exception message (better context).
@jenisys
jenisys merged commit fe83a71 into behave:master Apr 28, 2013
@jenisys

jenisys commented Apr 28, 2013

Copy link
Copy Markdown
Member

INTEGRATED INTO: behave-1.2.3a19

jenisys added a commit that referenced this pull request May 1, 2013
…ds, etc.

Improve diagnostics when parse errors occur (parse failure oracle).
tokunbo pushed a commit to tokunbo/behave-parallel that referenced this pull request Aug 28, 2013
CHANGES:

  * Add description attribute also to ScenarioOutline ctor.
  * Move description parameter to end of Scenario/ScenarioOutline ctor.
    => Problem because parameter was already used by steps.
  * Extend JsonFormatter to store Scenario/ScenarioOutline description.
  * Extend json_parser to handle Scenario/ScenarioOutline description.
  * Cleanup/refactor parser to avoid duplicated code fragments:
    => _build_*_statement()
    => subaction_detect_next_scenario() to avoid duplicated code fragments
    => action_next_scenario (tags and more...)
    => Add check that Background does not support tags.
    => ParseError: Add stripped line to exception message (better context).
tokunbo pushed a commit to tokunbo/behave-parallel that referenced this pull request Aug 28, 2013
…kgrounds, etc.

Improve diagnostics when parse errors occur (parse failure oracle).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants