Ask Your Question
4

How do I attach a cucumber report in json format using the XRay Jira API?

asked 2022-05-17 11:00:00 +0000

plato gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-11-21 16:00:00 +0000

nofretete gravatar image

To attach a cucumber report in JSON format using the XRay Jira API, follow these steps:

  1. Ensure that you have the necessary credentials and permissions to access the XRay Jira API.

  2. Generate the cucumber report in JSON format.

  3. Use the XRay Jira API to create a new issue or update an existing issue with the cucumber report as an attachment. The following API endpoint can be used for this purpose:

POST /rest/raven/1.0/api/testexec/{testExecKey}/attachment

Here, {testExecKey} is the key of the Xray test execution where you want to attach the report.

  1. In the request payload, set the multipart/form-data content type and include the cucumber report file as an attachment.

  2. Submit the request to the API endpoint.

An example request in cURL would look like this:

curl -X POST \
  https://{your-instance}/rest/raven/1.0/api/testexec/{testExecKey}/attachment \
  -H 'Authorization: Basic {base64-encoded-credentials}' \
  -H 'Content-Type: multipart/form-data' \
  -H 'cache-control: no-cache' \
  -H 'Postman-Token: {your-postman-token}' \
  -F file=@/path/to/cucumber_report.json \
  -F filename=cucumber_report.json \
  -F contentType=application/json \
  -F comment='Attaching cucumber report in JSON format'

Replace {your-instance} with the domain name of your Jira instance and {base64-encoded-credentials} with your Jira credentials in base64-encoded format (username:password).

The -F options specify the parameters for the attachment. Here, file is the path to the cucumber report file, filename is the name of the file, contentType is the MIME type, and comment is an optional comment you can include.

If successful, the API will return a response with the ID of the attachment that was uploaded.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-05-17 11:00:00 +0000

Seen: 1 times

Last updated: Nov 21 '22