Как напечатать параметр в шагах к отчету js огурца - PullRequest
0 голосов
/ 15 сентября 2018

У меня есть файл функций, похожий на этот.Я хотел напечатать примеры в сгенерированный отчет.Не удалось найти ни одного действительного решения.

Я создаю отчет json с помощью команды cucumber-js test/test.feature --require test/step.js --format json:test/report.json

Файл функции: -

Feature: Simple maths

  Scenario Outline: much more complex stuff
    Given a variable set to <var>
    When I increment the variable by <increment>
    Then the variable should contain <result>

    Examples:
      | var | increment | result |
      | 100 |         5 |    105 |
      |  99 |      1234 |   1333 |
      |  12 |         5 |     18 |

Сгенерированный отчет: -

[
  {
    "keyword": "Feature",
    "name": "Simple maths",
    "line": 1,
    "id": "simple-maths",
    "tags": [],
    "uri": "test/test.feature",
    "elements": [
      {
        "id": "simple-maths;much-more-complex-stuff",
        "keyword": "Scenario",
        "line": 10,
        "name": "much more complex stuff",
        "tags": [],
        "type": "scenario",
        "steps": [
          {
            "arguments": [],
            "keyword": "Given ",
            "line": 4,
            "name": "a variable set to 100",
            "match": {
              "location": "test/teststep.js:28"
            },
            "result": {
              "status": "passed",
              "duration": 1000000
            }
          },
          {
            "arguments": [],
            "keyword": "When ",
            "line": 5,
            "name": "I increment the variable by 5",
            "match": {
              "location": "test/teststep.js:33"
            },
            "result": {
              "status": "passed"
            }
          },
          {
            "arguments": [],
            "keyword": "Then ",
            "line": 6,
            "name": "the variable should contain 105",
            "match": {
              "location": "test/teststep.js:38"
            },
            "result": {
              "status": "passed",
              "duration": 1235000000
            }
          }
        ]
      }
    ]
  }
]

Я ожидаю правильности параметра или примера в отчете, подобном этому

{
  "steps": [
    {
      "arguments": [],
      "keyword": "Given ",
      "line": 4,
      "name": "a variable set to 100",
      "match": {
        "location": "test/teststep.js:28"
      },
      parameters: {
       "var": "100"
      },
      "result": {
        "status": "passed",
        "duration": 1000000
      }
    }
  ]
}

Есть ли способ, которым я могу достичь этого?

...