【问题标题】:Jira Xray empty Test Details with Behave or Cubumber reports带有行为或 Cubumber 报告的 Jira Xray 清空测试详细信息
【发布时间】:2021-03-18 21:15:40
【问题描述】:

我正在尝试遵循Testing using Behave in Python 教程。我可以让导入工作,但“执行详细信息显示 Cucumber 场景的结果”。不起作用。

这就是我正在做的事情:

  • 我正在创建一个新的测试执行(例如 PROJ-123)。
  • 我正在创建一个新的自动化 [Cucumber] 测试(例如 PROJ-234)
  • 我正在创建一个新的自动化 [Cucumber] 测试(例如 PROJ-345)

我在 Behave 中使用以下功能文件

@PROJ-123
Feature: Verify something

Scenario Outline: Verify something with <data>
  Given I use the data <data>
   Then the result is <result>

@PROJ-234
Examples:
| data | result |
|  1   |    1   |

@PROJ-345
Examples:
| data | result |
|  2   |    4   |

我正在运行:

behave -k --format=cucumber_json:PrettyCucumberJSONFormatter -o cucumber.json --junit --format=json -o reports/data.json x.feature

我正在导入报告:

curl -H "Content-Type: application/json" -X POST -u user:password --data @reports/data.json "https://jira.example.com/rest/raven/1.0/import/execution/behave"

服务器回复是:

{"testExecIssue":{"id":"574356","key":"PROJ-123","self":"https://jira.example.com/rest/api/2/issue/574356"},"testIssues":{"success":[{"id":"574408","key":"PROJ-234","self":"https://jira.example.com/rest/api/2/issue/574408"},{"id":"574409","key":"PROJ-345","self":"https://jira.example.com/rest/api/2/issue/574409"}]}}

但是当我查看 PROG-234 或 PROJ-345 的测试详细信息时,它是空的:

我也尝试过导入 Cucumber JSON 测试报告:

curl -H "Content-Type: application/json" -X POST -u user:pass --data @cucumber.json https://jira.example.com/rest/raven/1.0/import/execution/cucumber

{"testExecIssue":{"id":"574356","key":"PROJ-123","self":"https://jira.example.com/rest/api/2/issue/574356"},"testIssues":{"success":[{"id":"574408","key":"PROJ-234","self":"https://jira.example.com/rest/api/2/issue/574408"},{"id":"574409","key":"PROJ-345","self":"https://jira.example.com/rest/api/2/issue/574409"}]}}

结果完全相同:PROG-234 或 PROJ-345 的测试详细信息为空。

我正在使用带有 Xray 的 Jira Data Center v8.13.1。

编辑 1:塞尔吉奥在下面的评论指出,如果我有像下面这样的功能,它应该可以工作:

@PROJ-123
Feature: Verify something

  @PROJ-234
  # Jira Test ID
  Scenario Outline: Verify something with <data>
    Given I use the data <data>
     Then the result is <result>

Examples:
  | data | result |
  |   1  |    1   |
  |   2  |    4   |

第二个功能文件生成以下 Cucumber JSON 报告:

[
{
  "description": "",
  "elements": [
    {
      "description": "",
      "id": "verify-something;verify-something-with-1----@1.1-",
      "keyword": "Scenario Outline",
      "line": 13,
      "location": "x.feature:13",
      "name": "Verify something with 1 -- @1.1 ",
      "steps": [
        {
          "keyword": "Given",
          "line": 7,
          "match": {
            "location": "steps/x.py:3"
          },
          "name": "I use the data 1",
          "result": {
            "duration": 1996756,
            "status": "passed"
          },
          "step_type": "given"
        },
        {
          "keyword": "Then",
          "line": 8,
          "match": {
            "location": "steps/x.py:7"
          },
          "name": "the result is 1",
          "result": {
            "duration": 993013,
            "status": "passed"
          },
          "step_type": "then"
        }
      ],
      "tags": [
        {
          "line": 1,
          "name": "PROJ-234"
        }
      ],
      "type": "scenario"
    },
    {
      "description": "",
      "id": "verify-something;verify-something-with-2----@1.2-",
      "keyword": "Scenario Outline",
      "line": 14,
      "location": "x.feature:14",
      "name": "Verify something with 2 -- @1.2 ",
      "steps": [
        {
          "keyword": "Given",
          "line": 7,
          "match": {
            "location": "steps/x.py:3"
          },
          "name": "I use the data 2",
          "result": {
            "duration": 1998901,
            "status": "passed"
          },
          "step_type": "given"
        },
        {
          "keyword": "Then",
          "line": 8,
          "match": {
            "location": "steps/x.py:7"
          },
          "name": "the result is 4",
          "result": {
            "duration": 0,
            "status": "passed"
          },
          "step_type": "then"
        }
      ],
      "tags": [
        {
          "line": 1,
          "name": "PROJ-234"
        }
      ],
      "type": "scenario"
    }
  ],
  "id": "verify-something",
  "keyword": "Feature",
  "line": 2,
  "name": "Verify something",
  "status": "passed",
  "tags": [
    {
      "line": 1,
      "name": "PROJ-123"
    }
  ],
  "uri": "x.feature"
}
]

它没有。测试详细信息仍为空(带有行为或 Cucumber 报告)。

【问题讨论】:

    标签: json jira python-behave jira-xray


    【解决方案1】:

    目前不支持给定方案大纲中的多个“示例”部分。 此外,标签应该添加到场景大纲条目中,而不是示例部分。 另一个重要的事情是您拥有的测试,黄瓜类型应该是“场景大纲”而不是“场景”。这应该可以解决您最初的问题。

    【讨论】:

    • 我已经更改了我的功能文件,但我仍然没有得到要填写的测试详细信息。还有一点是,唯一不起作用的是 PROJ-234 和 PROJ- 345 未填写测试详细信息。它们与 PROJ-123 正确关联。
    • 你在 Jira 对应的 Test 问题中把 Scenario Type 改成“Scenario Outline”了吗?
    • 是的,feature文件就是我上面整理的,都是Scenario Outlines。
    • 您能否使用运行场景大纲时生成的 cucumber.json 文件更新您的问题(它必须只有一个示例部分)?
    【解决方案2】:

    这应该行不通,我应该更仔细地阅读教程:

    测试(规范)最初在 Jira 中创建为 Cucumber 测试,然后使用 UI 或 REST API 导出。

    测试详细信息不会由测试报告填充。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多