github-actionsjira-xray

XRAY-JIRA-CLOUD- Unable to import Xray JSON results from external source to XRAY JIRA for test cases


I am working on Integrating Github Actions and Xray Jira. Github Actions workflow is triggered from Xray Jira execution using Jira automation.

  1. My test execution consists of 2 test cases. Is there a way to pass the details of testkey(test cases) to Workflow ?
  2. Importing results back to Xray Jira from Github actions in xray json format does not update test cases status (pass/fail)

Created Xray JSON report (data.json)

Command used for importing Xray Json report -

curl -H "Content-Type: application/json" -X POST -H "Authorization: Bearer $token" --data @"data.json" https://xray.cloud.getxray.app/api/v2/import/execution 

Output -

{
  "id": "10515",
  "key": "xyz-244",
  "self": "https://xyz.atlassian.net/rest/api/2/issue/10515"
}

When verified -> only summary and description is updated but not the test results.

cat data.json

{
  "testExecutionKey": "XYZ-244",

  "info": {
    "summary": "Execution of automated tests for release",
    "description": "This execution is automatically created when importing execution results from an external source",
    "startDate": "2025-01-07T11:58:48Z",
    "finishDate": "2025-01-07T11:58:48Z"
  },

  "tests": [
    {
      "testKey": "XYZ-236",
      "start": "2025-01-07T11:58:48Z",
      "finish": "2025-01-07T11:58:48Z",
      "comment": "Successful execution",
      "status": "PASS"
    },
    {
      "testKey": "XYZ-231",
      "start": "2025-01-07T11:58:48Z",
      "finish": "2025-01-07T11:58:48Z",
      "comment": "Successful execution",
      "status": "PASS"
    }
  ]
}

Solution

  • The Xray JSON schema for Xray on Jira cloud is slightly different from Xray on Jira datacenter.

    In this case, the "status" values should be PASSED or FAILED (and not PASS or FAIL). That should be enough to solve your issue.