Search code examples
restjenkinscucumberjira-rest-apijira-xray

How to import test execution results using REST API and XRay for JIRA and Cucumber + Xray


I am trying to import test execution results for my project but am having difficulty associating tests with the test execution using the REST API. I have tried to emulate the instructions found at http://xray.xpand-it.com/display/XRAY/REST+API but it does not seem to be working. I can import a test execution without any associated tests.

Here is my request which I am posting to http:////rest/api/2/issue

"{""fields"": {""project"":{""key"": ""ET""}, ""summary"": ""Test execution"", ""description"":""Description"", ""issuetype"":{""id"":""10302""}, ""tests"":[{""testKey"" : ""ET-879"",""comment"" : ""Successful execution"",""status"" : ""PASS""},{""testKey"" : ""ET-880"",""comment"" : ""Execution failed"",""status"" : ""FAIL""},{""testKey"" : ""ET-881"",""comment"" : ""Successful execution"",""status"" : ""PASS""}]}}"

The "tests" field is not recognised, but I can't find the appropriate replacement to get this to work.

Any help you can give would be appreciated.


Solution

  • If you look here for the documentation it appears you have misspelled the values for you "status" field in your tests section. It appears you are looking for PASSED/FAILED as opposed to PASS/FAIL.

    Relevant documentation : https://confluence.xpand-it.com/plugins/servlet/mobile?contentId=32806690#ImportExecutionResults-XrayJSONformat