Submitting XRay Test Execution Evidence via Rest API in Version 3 Edited

It seems that the XRay Rest API Documetation has not been updated to reflect all changes in Version 3.

According to the documentation at "https://confluence.xpand-addons.com/display/XRAY/Test+Step+Results+-+REST" evidences should be sent in the following format:

      {
         "filename":"test.txt",
         "contentType":"plain/text",
         "data":"(BASE64 encoding)"
      }

However, it seems that this is not valid anymore. The documentation does not reflect the changes. Obviously the EvidenceBean has been substituted by the AttachementBean which accepts "filename" and "mimeType" properties but does not have any data fields. I can't figure out how to change the request for it to work.

And as I don't have admin access to our company's Jira I can't send a support request and I don't really want to go through the official channels for this.

Does anyone have an idea how the rest calls should be adjusted? I can't find anything on the internet.

1 answer

Hi Mohamed Ibrahim,

Thanks for your question; the documentation seems to be correct though.

 

If you do a POST request to an URL such as:

http://jiraserver/rest/raven/1.0/api/testrun/4151/step/3200/attachment 

 

And you pass the body json content such as:

{
"data":"iVBORw0KGgoAAAANSUhEUgAABkIAAAO9CAYAAADezXv6AAAAAXNSR0IArs4c6QAA",
"filename":"image21.jpg",
"contentType":"image/jpeg"
}

it works fine.

 

What Xray version are you using? This was evaluated in the latest one.

 

Best regards,

Xray Team

Unfortunately I do not know the exact version of the XRay installation because I do not have admin access to Jira. However I know that it is 3.x. If you need the exact version I can try to ask our admins if I can find them.

Posting the evidence the way you suggested does work, so I will try to use it instead of my original approach.

However, when trying to send following PUT Request to add the evidence while creating a test step execution I do get the error, and according to the documentation it should be fine:

jiraserver/rest/raven/1.0/api/testrun/42578/step/334560

{
   "status":"PASS",
   "comment":"Everything worked as expected :)",
   "evidences":[{
       "data":"SGVsbG8=",
       "filename":"testfile.txt",
        "contentType":"plain/text"
   }]
}

 

I then get some error message, here the first part of it:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>500</status-code><message>Unrecognized field &quot;data&quot; (Class com.xpandit.raven.beans.AttachmentBean), not marked as ignorable
 at [Source: org.apache.catalina.connector.CoyoteInputStream@1a57974; line: 6, column: 13] (through reference chain: com.xpandit.raven.beans.TestStepResultBean[&quot;evidences&quot;]-&gt;com.xpandit.raven.beans.AttachmentBean[&quot;data&quot;])</message><stack-trace>org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field &quot;data&quot; (Class com.xpandit.raven.beans.AttachmentBean), not marked as ignorable
 at [Source: org.apache.catalina.connector.CoyoteInputStream@1a57974; line: 6, column: 13] (through reference chain: com.xpandit.raven.beans.TestStepResultBean[&quot;evidences&quot;]-

Hi Mohamed Ibrahim,

Unfortunately that's a bug.

We're on it. You may track it here: https://jira.xpand-addons.com/browse/XRAY-3106

 

Best regards,

Xray Team

Hi José Domingues ,

how can I find the stepResultId

for use http://jiraserver/rest/raven/1.0/api/testrun/id/step/stepResultId/attachment ,

 

Thanks

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 13, 2019 in Marketplace Apps

Marketplace Spotlight: Marketing apps for Confluence to keep your teams working on the same page

                                                      &nbsp...

280 views 0 7
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you