Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

🧩 Question: Unable to Upload Evidence to Xray Server Test Runs — Status Update Works Fine

Aryan Srivastava
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 29, 2025

 

Hi Atlassian/Xray community,

We're using Xray Server (not Cloud), and we're building a custom internal tool to manage test executions via API. Here's the context:


What’s Working

  • I can successfully fetch test executions using:

    GET /rest/api/2/search?jql=Project=RTM AND issuetype='Test Execution'
  • I can fetch the test cases linked to a test execution via:

    GET /rest/raven/1.0/api/testexec/{testExecutionKey}/test
  • I can fetch the testRunId of each test case using the value from:

    issue.fields.customfield_21623[].testRunId
  • I can update the status of a test run with:

    PUT /rest/raven/1.0/api/testrun/{testRunId}
    Body: { "status": "PASS" }

    ✅ This works perfectly and updates in Jira UI.


What’s Not Working

I'm trying to upload .docx or .png files as evidence to a test run using the endpoint:

POST /rest/raven/1.0/api/testrun/{testRunId}/attachments

 I get the following error response:

<status>
  <status-code>404</status-code>
  <message>null for uri: https://mycompanyjira.com/rest/raven/1.0/api/testrun/2572671/attachments</message>
</status>

This happens even though:

  • The test run ID is valid (verified via /api/test-runs)

  • The test run has manual steps (we assume — but not 100% sure)

  • The evidence files are small and standard (e.g., .docx, .png)


🔄 What I Tried Instead

To work around the issue, I also attempted using:

 

POST /rest/raven/1.0/import/execution

 With this payload:

 

{
  "testExecutionKey": "RTM-622283",
  "tests": [
    {
      "testKey": "RTM-623929",
      "status": "PASS",
      "evidences": [
        {
          "data": "base64encoded",
          "filename": "test.docx",
          "contentType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
        }
      ]
    }
  ]
}

But this also fails silently or does not attach the evidence, even though the status is updated.


Questions for the Community

  1. Does POST /testrun/{id}/attachments only work if the test run has manual steps?

  2. Are there any permissions or configurations required on the Jira/Xray side to allow attachments via API?

  3. Should we be using POST /import/execution for uploading evidence instead — and if so, does it overwrite the execution or merge?

  4. What is the recommended way to programmatically upload evidence to each test case inside a test execution on Xray Server?


Any help or clarification would be greatly appreciated!

Thanks 🙏
— Aryan

1 answer

0 votes
Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 3, 2025

Hi @Aryan Srivastava 

Welcome to the community.

Question 1: It seems (documentation based), Yes that this can only be on test with manual test steps. you could reach out to Xray support to get this confirmed.

Related is, I don't seem to find what type of evidence can be attached, might be the docx is not an option.

Question 2: No, this is based on Jira access.

The others I can't answer for you. I hope I could help.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events