简体   繁体   中英

Jira Xray empty Test Details with Behave or Cubumber reports

I'm trying to follow the Testing using Behave in Python tutorial. I can get the import to work, but the "The execution details displays the result of the Cucumber Scenario." does not work.

Here's what I'm doing:

  • I'm creating a new Test Execution (say, PROJ-123).
  • I'm creating a new Automated[Cucumber] test (say, PROJ-234)
  • I'm creating a new Automated[Cucumber] test (say, PROJ-345)

I'm using the following feature file with 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   |

I'm running behave with:

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

I'm importing the report with:

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"

The server reply is:

{"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"}]}}

But when I look at the Test Details for either PROG-234 or PROJ-345, it's empty: 它是空的

I've also tried to import the Cucumber JSON test report:

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"}]}}

The result is exactly the same: empty Test Details for either PROG-234 or PROJ-345.

I'm using Jira Data Center v8.13.1 with Xray.

Edit 1: Sergio's comment below states that if I have a feature like the one below it should work:

@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   |

This second feature file generates the following Cucumber JSON report:

[
{
  "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"
}
]

It doesn't. The Test Details are still empty (with Behave or Cucumber reports).

Multiple "Examples" sections in a given Scenario Outline are not supported, at this time. Also, the tag should be added on the Scenario Outline entry and not on the Examples section. Another important thing is that the Tests you have, the Cucumber Type should be "Scenario Outline" and not "Scenario". This should fix your initial problem.

This isn't supposed to work, I should have read the tutorial more carefully:

The test (specification) is initialy created in Jira as a Cucumber Test and afterwards, it is exported using the UI or the REST API.

The Test Details won't be populated by a test report.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM