Cucumber JSON results not linking to Xray test execution in Jira

I’m having trouble with Jira Xray integration. When I use the /rest/raven/2.0/import/execution/cucumber/multipart? endpoint to upload my cucumber test results, the test execution gets created successfully but none of my test cases show up in it. I’ve also tried doing the import manually through the UI using “Import Execution Results” but same issue happens.

I’m not sure what’s wrong with my cucumber JSON format or if I’m missing something in the configuration. Has anyone faced this before?

My project info:

{
  "fields": {
    "project": {
      "key": "MYPROJ"
    },
    "summary": "Automated Test Run Results",
    "description": "Cucumber test execution import",
    "issuetype": {
      "id": "10009"
    }
  }
}

Sample cucumber JSON:

[
  {
    "uri": "features/UserAuth.feature",
    "elements": [
      {
        "name": "User can sign in with correct details",
        "id": "user-can-sign-in-with-correct-details",
        "steps": [
          {
            "name": "user opens the signin form",
            "keyword": "Given ",
            "result": {
              "status": "passed"
            }
          },
          {
            "name": "user provides correct username and password",
            "keyword": "When ",
            "result": {
              "status": "passed"
            }
          },
          {
            "name": "user should see the home screen",
            "keyword": "Then ",
            "result": {
              "status": "passed"
            }
          }
        ]
      },
      {
        "name": "User cannot sign in with wrong details",
        "id": "user-cannot-sign-in-with-wrong-details",
        "steps": [
          {
            "name": "user opens the signin form",
            "keyword": "Given ",
            "result": {
              "status": "passed"
            }
          },
          {
            "name": "user provides incorrect credentials",
            "keyword": "When ",
            "result": {
              "status": "failed",
              "errormessage": "Authentication failed"
            }
          },
          {
            "name": "user should see error notification",
            "keyword": "Then ",
            "result": {
              "status": "passed"
            }
          }
        ]
      }
    ]
  }
]

I see the problem in your cucumber JSON - you’re missing a key piece. Your scenarios need tags that reference existing Jira test issue keys. Right now your JSON has scenarios but no tag references to actual Test issues in MYPROJ. Xray uses these tag mappings to link execution results with existing Test issues. If you haven’t created Test issues for these scenarios yet, you’ll need to do that first in Jira. Then update your cucumber runner config to include the right tags in the output. The import won’t auto-create new Test issues from just scenario names.

I’ve faced similar challenges with the Jira Xray integration before. It’s crucial to ensure that your cucumber scenarios are properly associated with the relevant Test issues in Jira. If your test results are being created but not linked, it’s likely because Xray cannot find the corresponding Test issues. To resolve this, ensure you are tagging each scenario with the appropriate Jira Test issue keys, such as @MYPROJ-123. This linkage is vital for Xray to recognize the results from your cucumber tests, leading to successful integration.

You’re missing the scenario tags in your JSON. Xray needs @tags with test issue keys to link scenarios to existing tests. Without those tags, it just creates an empty execution. Add tags like @MYPROJ-456 to your scenario elements in the cucumber output.