Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

API - how to attach file to test results


Based on below post from 2014
Is attaching files to test result thru API possible or still pending development?
If it is pending development = do we know when this will be released?

Does the API support Upload/Download

Hi @seba,

Thanks for your posting and feedback! It’s not under active development currently but it’s definitely still planned to review this for a future version. We still have this on our list. As suggested in the thread, we recommend uploading attachments and images to an external location and then simply including a link in the test result or case description.



It would be very nice feature to have, lets add +1 for this feature request.


Thanks again for your feedback, @seba :slight_smile:



Is there any update on adding this support to the API?

If you can manually add attachments to a result, then the API should also support it.


We also should have the possibility to add attachements to the result!


+1 to this feature. As already there are more systems to maintain, we may not want to add another external system in list.


hope this still gets a count… but ´+1 from me


not sure about the mini api but here is a simple way to do it (on windows - you can do the same thing on linux with tomcat and simlinks)

test rail is hosted in IIS. so in IIS just create a new virtual directory under the test rail site and call it something like ‘screenshots’. Point this virtual directory to a network share that your tests save your attachments to.

Then when you’re updating a result comment via the API, just use the (link) sintax and give it the relative path (relative to your site home i.e. ‘[relative dir]’) to your attachment via the virtual directory i.e. ‘/screenshots/attachment.png’ and vioala

so, to sum it up
-create a network share that can be accessed by your test rail server and your tests:

-create a virtual directory in IIS under the test rail site:
’attachments’ -> '\share\attachments’

-save an attachment during test run (fun.png):

-log link to attachment in a result comment or some step result via the test rail api
self.client.send_post(‘add_result_for_case/[testrunid]/[testcaseid]’), {‘comment’: ‘see attachment here: (/attachments/fun.png)’ }

this works like a charm storing and showing screenshots during selenium test runs! Let me know if anyone has any questions!