Skip to content

Description in scenario #351

@manne11

Description

@manne11

Hi,

I would like to write description for a scenario in the feature file. However when I generate a cucumber json report(with --cucumber-json option)with description added to the scenario, the json report is empty.

Here is my feature Feature file with description added to the scenario:


Feature: Blog
    A site where you can publish your articles.

Scenario: Publishing the article
    Here is some description
    Given I'm an author user
    And I have an article
    When I go to the article page
    And I press the publish button
    Then I should not see the error message
    And the article should be published  
 

Also, my test file:

from pytest_bdd import scenario, given, when, then

@scenario('random_tow.feature', 'Publishing the article')
def test_publish():
    assert True


@given("I'm an author user")
def author_user():
    assert True


@given('I have an article')
def article():
    assert True


@when('I go to the article page')
def go_to_article():
    assert True


@when('I press the publish button')
def publish_article():
    assert True


@then('I should not see the error message')
def no_error_message():
    assert True


@then('the article should be published')
def article_is_published():
    assert True


I noticed that there is a "description" key for a scenario in the generated json report.
NOTE: This report was generated when no description was filled in the scenario section:

[
  {
    "keyword": "Feature",
    "uri": "tests_self/random_tow.feature",
    "name": "Blog",
    "id": "tests_self/random_tow.feature",
    "line": 1,
    "description": "A site where you can publish your articles.",
    "tags": [],
    "elements": [
      {
        "keyword": "Scenario",
        "id": "test_publish",
        "name": "Publishing the article",
        "line": 4,
        "description": "",    -----------------------------------------------------> DESCRIPTION KEY
        "tags": [],
        "type": "scenario",
        "steps": [
          {
            "keyword": "Given",
            "name": "I'm an author user",
            "line": 5,
            "match": {
              "location": ""
            },
            "result": {
              "status": "passed",
              "duration": 117063
            }
          },
          {
            "keyword": "And",
            "name": "I have an article",
            "line": 6,
            "match": {
              "location": ""
            },
            "result": {
              "status": "passed",
              "duration": 96797
            }
          },
          {
            "keyword": "When",
            "name": "I go to the article page",
            "line": 7,
            "match": {
              "location": ""
            },
            "result": {
              "status": "passed",
              "duration": 38385
            }
          },
          {
            "keyword": "And",
            "name": "I press the publish button",
            "line": 8,
            "match": {
              "location": ""
            },
            "result": {
              "status": "passed",
              "duration": 35762
            }
          },
          {
            "keyword": "Then",
            "name": "I should not see the error message",
            "line": 9,
            "match": {
              "location": ""
            },
            "result": {
              "status": "passed",
              "duration": 32901
            }
          },
          {
            "keyword": "And",
            "name": "the article should be published",
            "line": 10,
            "match": {
              "location": ""
            },
            "result": {
              "status": "passed",
              "duration": 32901
            }
          }
        ]
      }
    ]
  }
]

Could you suggest how to fill description for the scenario in the feature file?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions