You can manage Tests directly through the JIRA REST API. Xray provides additional methods for managing Test Steps andexporting the Test definitions and test runs.
Creating and Editing Tests - JIRA REST API
Xray Test issues can be created and edited though the JIRA REST API.
Learn more
All Test issue custom fields provided by Xray add-on can be modified using the JIRA REST API:
- Test Type (default JIRA select field)
- Cucumber Test Type (default JIRA select field)
- Cucumber Scenario (default JIRA text field)
- Manual Test Steps (JSON format; example below)
The custom field IDs can be discovered using the JIRA REST API Browser tool included in JIRA. Each ID is of the form "customfield_ID".
Another option, which does not require JIRA administration rights, can be invoking the "Get edit issue meta" in an existing issue (e.g. in a Test issue) as mentioned here.
Ex: GET http://yourserver/rest/api/2/issue/CALC-1/editmeta
"Manual Test Steps" custom field value format
{ "fields": { "customfield_10004": { "steps": [ { "index": 0, "step": "Step 1", "data": "input Data 1", "result": "Excepted result 1" }, { "index": 1, "step": "Step 2", "data": "input Data 2", "result": "Excepted result 2" }, { "index": 2, "step": "Step 3", "data": "input Data 3", "result": "Excepted result 3" }, { "index": 3, "step": "Step 4", "data": "input Data 4", "result": "Excepted result 4" } ] } } }
Please see next a full Test creation example using JIRA's REST API endpoint for creating issues.
Exporting Tests
To export tests to json you need to specify the keys, the id of the filter or jql query of the issues you want to export, at least one query parameter has to be specified but all 3 can be sent at the same time.
Exporting Test Runs
To export the test runs of a test you need to specify the key of the Test you wish to export the test runs from. You can filter the Test runs by Test Environment.
Exporting Test Sets
To export the test sets of a test you need to specify the key of the Test you wish to export the test sets from
Exporting Test Executions
To export the test executions of a test you need to specify the key of the Test you wish to export the test executions from
Exporting Test Plans
To export the test plans of a test you need to specify the key of the Test you wish to export the test plans from