Exporting datasets

Datasets can be defined for parameterized tests at different levels. The respective test issue and optionally context issue must be given as input to the endpoint to export the dataset at a given level.

When exporting the dataset of a test in the context of a test plan or a test execution, the requested dataset can be the one actually defined at that level or the one resolved up to that level.


The following table shows the exported dataset for the different input combinations:

Test issueContext issueResolvedResult dataset
YesNoN/ADataset defined in the test (default dataset)
YesTest plan
false
Dataset defined in the test in the test plan
YesTest plan
true
Resolved dataset at the test plan - test level
YesTest execution
false
Dataset defined in the test in the test execution
YesTest execution
true
Resolved dataset at the test run level



Returns the a CSV file with the requested dataset for the input issue ids.

Request

QUERY PARAMETERS

parameter
type
description
testIssueId
String

The issue id of the test.

testIssueKey
StringThe issue key of the test.
contextIssueId
StringThe issue id of the context issue (a test plan or a test execution).
contextIssueKey
StringThe issue key of the context issue (a test plan or a test execution).
resolved
Boolean

A flag indicating if the exported dataset must be resolved or not for the given level (true by default).


One of testIssueId or testIssueKey is required. If both are provided, testIssueId is used.

Both contextIssueId and contextIssueKey are optional. If both contextIssueId and contextIssueKey are provided, contextIssueId is used.

The resolved flag is only relevant when requesting the dataset of a test with a context issue.

The returned dataset is provided with all the iterations generated.


Example Requests

curl -X GET -H "Authorization: Bearer $token"  "https://xray.cloud.getxray.app/api/v2/dataset/export?testIssueKey=DEMO-1&contextIssueKey=DEMO-2&resolved=false" --output $filename.csv


Or use the "-OJ" options to use the filename returned in the response:

curl -X GET -H "Authorization: Bearer $token" "https://xray.cloud.getxray.app/api/v2/dataset/export?testIssueKey=DEMO-1&contextIssueKey=DEMO-2&resolved=false" -OJ


Responses

200 OK : application/octet-stream : Successful. A CSV file will be downloaded containing the requested dataset.

400 BAD REQUEST : text/plain : No CSV file was generated. Please check the response error message.

401 UNAUTHORIZED : text/plain : The Xray license is not valid.

404 NO CONTENT : text/plain : There is no dataset for the requested level.

500  INTERNAL SERVER ERROR : text/plain : An internal error occurred when generating the CSV file.

  • No labels